K
K
kejabuvu2017-03-11 15:41:35
MongoDB
kejabuvu, 2017-03-11 15:41:35

MongoDB how to find any value in case nothing is set in parameters?

Good day!
Tell me how to find any value if the parameters are empty? In this case, the structure of the request must be preserved.

db.ad.find({"electronics.categoryId" : 1}).count(); //все ок
db.ad.find({"electronics.categoryId" : ????????? }).count(); //показать все, если в параметрах пусто

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2017-03-11
@kejabuvu

?

db.ad.find({"electronics.categoryId": { $exists: false } }).count();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question