MongoDB: Find a document by non-existence of a field?

Is there a way to specify a condition of “where document doesn’t contain field” ?

For example, I want to only find the first of these 2 because it doesn’t have the “price” field.

{"fruit":"apple", "color":"red"}


{"fruit":"banana", "color":"yellow", "price":"2.00"}

1 Answer
1

Leave a Comment