Is there is a way to find out the reason why a query would return no result in monogodb ?
Suppose we have a collections that stores employees and I want to fetch any employee with the name X, address Y and age Z.
I will write some query like:
BasicDBObject query = new BasicDBObject();
query.put("name","X"); query.put("address","Y"); query.put("age","z");
If this query returns null, how do I know whether it is because no employee with the name X, or no employee with the address Y, or no employee with the age z ? or there is way ?
There is no way to do it out of the box. You have to perform multiple queries or make one query with first condition and iterate over collection in your application code to find out whether others conditions match