return .NET Core 中 DocumentDB 中新创建文档的 ID
return id of newly created document in DocumentDB within .NET Core
我正在使用以下内容创建 DocumentDB 文档,如何将其修改为 return 所创建文档的 guid id?
_logger.LogInformation("creating document");
Uri uri = UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId);
await client.CreateDocumentAsync(uri, doc);
保存后直接从文档中读取id值:
await client.CreateDocumentAsync(uri, doc);
_logger.LogInformation($"created document {doc.Id}");
我正在使用以下内容创建 DocumentDB 文档,如何将其修改为 return 所创建文档的 guid id?
_logger.LogInformation("creating document");
Uri uri = UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId);
await client.CreateDocumentAsync(uri, doc);
保存后直接从文档中读取id值:
await client.CreateDocumentAsync(uri, doc);
_logger.LogInformation($"created document {doc.Id}");