Reputation: 2851
I am using the following to create a DocumentDB document, how can I ament it to return the guid id of the document that gets created?
_logger.LogInformation("creating document");
Uri uri = UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId);
await client.CreateDocumentAsync(uri, doc);
Upvotes: 2
Views: 363
Reputation: 236268
Simply read id value from the document after saving it:
await client.CreateDocumentAsync(uri, doc);
_logger.LogInformation($"created document {doc.Id}");
Upvotes: 2