Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Cosmos DB Mongodb $t and $v

I got 2 Azure Cosmos DB's which runs in MongoDb. The first one was created by someone else and second one was created by me.

If I query my database, my structure gets very weird with a $t and $v property.

My structure:

enter image description here

Structure of the other DB (like it should be): enter image description here

My backend does work properly with both, but I want to add Azure Search and I can't do this with my structure. Why is this happening and how can I fix it?

like image 935
stef morren Avatar asked Aug 22 '17 10:08

stef morren


People also ask

What is the difference between Cosmos DB and MongoDB?

Cosmos DB also does not support time-series data. MongoDB, on the other hand, lets you run key-value, graph, and SQL queries against the same data. And, with MongoDB 5.0, you can build and run applications with support for specific time-series data storage and query patterns.

Is Cosmos DB compatible with MongoDB?

The Azure Cosmos DB for MongoDB is compatible with MongoDB server version 3.6 by default for new accounts. The supported operators and any limitations or exceptions are listed below. Any client driver that understands these protocols should be able to connect to Azure Cosmos DB for MongoDB.

Which is better MongoDB or Cosmos DB?

Azure Cosmos DB is comparatively faster than MongoDB in most common use cases, although MongoDB performs better over 1MB payload. MongoDB offers more flexibility in terms of setup. It runs on-prem, any cloud provider (Google Cloud Platform, AWS, Azure and more).

Is Azure Cosmos DB is MongoDB?

Azure Cosmos DB does not host the MongoDB database engine.


2 Answers

(If someone can make this a comment instead of an answer, it would be appreciated)

I'm getting the same thing. It looks like Microsoft gave an answer here as to why it happens: http://answers.flyppdevportal.com/MVC/Post/Thread/e0ffdbcd-0b43-4cd5-9d21-1a95ce0279dd?category=azuredocumentdb

The incorrect format is a result of intermixing the Cosmos DB: MongoDB API with the Cosmos DB: DocumentDB API.

It's not very clear to me though why those two are intermixed since MongoDb maintains the MongoDB API NuGet.

like image 82
Steve Haselschwerdt Avatar answered Oct 19 '22 21:10

Steve Haselschwerdt


This is happening because one of your Cosmos DB MOngoDB API accoutn is older than the other - older one uses JSON schema (used by SQL API as well), while newer uses more versatile (and MongoDB compliant) BSON schema. You just need to request the conversion of the account to a new schema by emailing [email protected]

like image 1
alekseys Avatar answered Oct 19 '22 19:10

alekseys