Azure/azure-cosmos-python

Intermixing Mongo API and DocumentDB API breaks document structure

Closed this issue · 5 comments

Working with Cosmos I initially loaded documents through the Mongo API. When shifting over to using pydocumentdb I've run into formatting issues with the generated results ($t and $v key-values are inserted throughout the document).

An example of this problem can be found on stackoverflow, but no solution is provided for switching the API used to access the data.

Expected Format:
as72v

Actual Format:
8b9pl

@jdk514 there is nothing wrong here. DocumentDB API provides different view over your data. Basically you can think about it as data which gets in using MongoDB API will have a slightly different representation when looking at it through DocumetnDB API.

Actually the problem described on StackOverflow looks similar but it's a different problem - they have two different schemas in different accounts but they use them with MongoDB API only.
In your case - inter-operability of the APIs is only possible between SQL and Gremlin API, others are not inter-operable.

Does this mean that if I try to connect spark to my cosmos collection it will fail? I'm following the information here, which indicates I will be hooking into cosmos using the DocumnetDB Java SDK. Given the issue of intermixing API's, it looks like this process will fail as the data will be improperly formatted.

@emilylawton can you please respond to the last question.

Closing this issue due to age. Active development of our Python SDK has moved to https://github.com/Azure/azure-sdk-for-python. We have also released 4.0 which includes many updates and new features. If this issue still needs our attention, please reopen it in the new repository.