Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
243 views
in Technique[技术] by (71.8m points)

MongoDB aggregation query null and value

I store a couple of content objects in a mongodb collection:

{ ..., category: "example1", collection: 'collectionX' },
{ ..., category: "example2", collection: null },
{ ..., category: "example1", collection: null }

I want to query the third option by the following query:

[
  { '$match': { 'category': 'example1' } },
  { '$match': { 'collection': null } }
]

Unfortunately, the result is empty. The query for both options separately returns the expected result. What is wrong?

question from:https://stackoverflow.com/questions/65599720/mongodb-aggregation-query-null-and-value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...