D
D
driver4582017-08-08 00:05:51
MongoDB
driver458, 2017-08-08 00:05:51

How to select documents from MongoDB that don't match a query?

I have several checkboxes on a page. And when they are all enabled, then in theory all products should be displayed, but this does not happen. You need to invert the query to find out which elements do not pass.
An object like this is passed as a request:

{ "$elemMatch": { $or: a:1 } }
{ "$elemMatch": { $or: a:2 } }
{ "$elemMatch": { $or: a:3 } }

only a little more complicated, ~ 10 elements out of 600 do not fall into the selection

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question