B
B
buylov2018-04-06 15:20:34
MongoDB
buylov, 2018-04-06 15:20:34

Is it possible to receive a response about the absence of the requested data through the MongoDB aggregation pipeline?

Hello!
Is it possible to make such a query to MongoDB in order to get in the response not only what is there, but also what is not there? For example, using the $match operator, I want to get data for users with ids 1, 2, and 3. But Mongo only has data for users 1 and 2. Can a response be returned that contains both data for users 1 and 2, and for the user 3 with a value like "Not Found"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2018-04-06
@zoonman

There is no such thing in MongoDB. As far as I know, even MySQL does not have such an option.
You can always invert the condition and substitute the inversion into the second query.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question