创建索引会导致未经授权的错误

有用于此目的的 和 命令。argslocals


例如,对于这个(无意义的)示例代码:


package main


import "fmt"


func example(a, b int) (c int) {

  d := a + b

  if true {

    e := d + 123

    c = e + 1

    fmt.Println("time for a breakpoint")

  }

  return c

}


func main() {

  example(2, 3)

}

当停止在 print 语句处时,输出如下所示:


(dlv) args

a = 2

b = 3

c = 129

(dlv) locals

d = 5

e = 128

有关可用命令的更多详细信息,请参阅 Delve 的 cli/README.md。


慕沐林林
浏览 68回答 1
1回答

catspeake

我已经联系了微软的支持,这是他们的回复:这是对具有时间点还原的帐户的限制。必须使用唯一索引创建集合。https://docs.microsoft.com/en-us/azure/cosmos-db/continuous-backup-restore-introduction您可以使用这样的命令创建具有已存在的唯一索引的集合(从Mongo外壳,或Robo3T或其他客户端)用于管理 Azure Cosmos DB 的 MongoDB API 中数据的 MongoDB 扩展命令|微软文档例如:db.runCommand({&nbsp; customAction: "CreateCollection",&nbsp; collection: "my_collection",&nbsp; shardKey: "my_shard_key",&nbsp; offerThroughput: 100,&nbsp; indexes: [{key: {_id: 1}, name: "_id_1"}, {key: {a: 1, b: 1}, name:"a_1_b_1", unique: true} ]})所以现在我的代码看起来像这样:func Collection(db *mongo.Database, c string, indices []bson.M) *mongo.Collection {&nbsp; &nbsp; ctx, cls := context.WithTimeout(context.Background(), time.Second * 15)&nbsp; &nbsp; defer cls()&nbsp; &nbsp; if cursor, _ := db.ListCollectionNames(ctx, bson.M{"name": c}); len(cursor) < 1 {&nbsp; &nbsp; &nbsp; &nbsp; cmd := bson.D{{"customAction", "CreateCollection"}, {"collection", c}}&nbsp; &nbsp; &nbsp; &nbsp; if indices != nil {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cmd = append(cmd, bson.E{Key: "indexes", Value: indices})&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; res := db.RunCommand(ctx, cmd)&nbsp; &nbsp; &nbsp; &nbsp; if res.Err() != nil {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log.Fatal(res.Err())&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }&nbsp; &nbsp; return db.Collection(c)}
打开App,查看更多内容
随时随地看视频慕课网APP