mongodb - Mongo distinct query returns several records one of which is "". But find null fails to find it -
i ran distinct query on collection. query syntax:
db.collection.distinct("dict.field")
i got set of results - 1 of "" (null).
i tried find record had null value field in question:
db.collection.find({"dict.field": null})
to surprise, no record found.
no indexes set on collection other _id.
the field in question dictionary.
what missing?
you should db.collection.find({"dict.field": ""})
instead. null , string ("") considered different datatypes.
Comments
Post a Comment