MongoDB Differentiates Between undefined vs. null

后端 未结 3 1174
旧巷少年郎
旧巷少年郎 2021-01-17 21:23

I was checking logic for querying on non-values and noticed when using the mongo shell, it differentiates between undefined and null v

3条回答
  •  误落风尘
    2021-01-17 22:24

    If you want to return a document where a field exists AND is not null, use { a : {$ne : null}}

    Undefined and null values are different, but the shell shows them both as null - https://jira.mongodb.org/browse/SERVER-6102

提交回复
热议问题