Cosmosdb mongo api does not work for some teams

I am using cosmosdb on the azure image. In this I am using the mongodb api
. I have a "query that has an array inside "

If I use this command:

db.getCollection('requests').find({"claims.id": 1002})

It does not work in cosmosdb mongo api, but it works for the local mongo service instance that I posted.

my request object is below

{
    "_id" : NumberLong(1001),
    "claims" : [ {
            "type" : "broadband",
            "id" : NumberLong(1002),
            "createdOn" : NumberLong(1462799667905)
              } ]
}
+2
source share
1 answer

Not all MongoDB query syntax / features are implemented. It looks like such a case.

- CosmosDB (MongoDB API):

db.getCollection('request').find({claims: { $elemMatch: { id:1002 }}}).pretty()
{
  "_id" : 1001,
  "claims" : [
    {
      "type" : "broadband",
      "id" : 1002,
      "createdOn" : NumberLong("1462799667905")
    }
  ]
}

, db.request.find() getCollection().

+2

All Articles