Search code examples
javamongodbazuregrailsazure-cosmosdb

Azure mongodb $in query not working


I have employee collection with 140 documents

{

    "name" : "name1",

    "dept" : "tech",

    "address" : "adr3"

}

In all 140 documents dept is tech When I execute the query in azure mongodb

    MongoDatabase db = mongo.getDatabase("test")
    def query = new BasicDBObject(['dept':['$in':['tech']]])
    FindIterable documents = db.getCollection("employees").find(query)
    def outList =  documents.collect {it}

I get only 101 documents instead of 140 records

This works fine in local mongodb. Till last week this was working in azure for me. Am I doing something wrong here ? Anyone facing similar situation ?

If I change query to

def query = new BasicDBObject(['dept':'tech'])

I get all 140 documents

If I change batch size to 10, $in query returns only 10 documents.


Solution

  • Xal. According to the sharing in this case : Cosmos Mongo API "In" Array expression issue ,it seems that the issue on Microsoft side.You could wait until the bug fixed.

    The reply as below:

    Thank you David for reporting this! I investigated the issue, it’s a bug on our side manifesting under a combination of conditions. I already have made a fix for it and will check it in by end of week (then it’s up to our deployment cycle to propagate the fix to all datacenters around the world). Let me know if you have queries that don’t work and are blocking you. Best regards, Orestis

    Hope it helps you.