Azure mongodb $in 查询不工作

Azure mongodb $in query not working

我有包含 140 个文档的员工集合

{

    "name" : "name1",

    "dept" : "tech",

    "address" : "adr3"

}

在所有 140 个文件中,部门是技术部门 当我在 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}

我只得到 101 个文档而不是 140 个记录

这在 local mongodb 中工作正常。直到上周,这对我来说都是天蓝色的。 我在这里做错了什么吗?有人面临类似情况吗?

如果我将查询更改为

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

我得到了所有 140 个文件

如果我将批量大小更改为 10,$in 查询 returns 只有 10 个文档。

我遇到了同样的问题,我使用 $elemMatch

解决了这个问题
mongoDB.collection('mycol', (err, collection) => {            
    if (err) throw err;            
    collection.find({dept: {$elemMatch:{$in : ['tech']}}}).toArray((err, docs) => {
        console.log(docs);
    });
});

Xal。根据本案例的分享:,微软side.You的issue好像可以等bug修复了

回复如下:

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

希望对你有帮助。