MongoDb query array with null values

后端 未结 3 1385
旧巷少年郎
旧巷少年郎 2021-02-20 07:51

I have objects in my collection that look like:

{ MyArray:[null, \"some value\", null] }

I want to query those objects that have a null value a

3条回答
  •  孤街浪徒
    2021-02-20 08:23

    Ok, I figured it out by loading my "null" candidates via my C# driver and it turns out that the values are not null, but Bson Undefined!! They are displayed as "null" in the shell! See http://jira.mongodb.org/browse/SERVER-2426. This works:

    db.xxx.find({"Attrs":{$type:6}})

提交回复
热议问题