Not sure what I'm doing wrong here, but I'm trying to insert a document into my-documents in the storage database my-db but this isn't happening.
I create a document client like this-
_endpointUri = new Uri(Properties.Settings.Default.DocumentDBEndpoint);
_privateKey = Properties.Settings.Default.DocumentDBKey;
_databaseName = Properties.Settings.Default.DocumentDBDatabase;
_collectionName = collectionName;
_collectionUri = UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName);
_documentClient = new DocumentClient(_endpointUri, _privateKey);
I then try to insert a document into the collection.
public async Task Set(T document)
{
await _documentClient.CreateDocumentAsync(_collectionUri.ToString(), document);
}
I tried passing the _collectionUri as well as the toString and they both do the same thing. If I step through the debugger the toString of that collection uri looks like-
dbs/my-db/colls/my-documents
I've tried set .ConfigureAwait(false) on the call, as well as not awaiting it at all. Of course when it's not awaited it steps over the line fine, but no document ever gets added to the my-documents collection.
I'm not sure if i'm using CreateDocumentAsync (also tried UpsertDocumentAsync) because not errors are thrown.
Can anyone see from the information given what mistake I'm making?
Edit In my testing with Azure I did opt to use DocumentDB with MongoDB Api. That may be related. Since I can easily blow it all away I will recreate it using the DocumentDB Api and see if that fixes the problem.