1.

If all documents for the $min operation have null value for the field or are missing the field, the $min operator returns ____ for the minimum value.(a) 1(b) 0(c) null(d) none of the mentionedI had been asked this question in an interview for internship.My doubt is from Pipeline Operators topic in division Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

Right answer is (c) null

To EXPLAIN: If some, but not all, DOCUMENTS for the $min operation have either a null VALUE for the field or are missing the field, the $min operator only considers the non-null and the non-missing values for the field.



Discussion

No Comment Found

Related InterviewSolutions