"Ignore" word in Question #4

Question # 4: How many documents in the citibike.trips collection have the key tripduration set to null? Ignore any documents that do not contain the tripduration key.

The word “Ignore” here means should the final count can have the docs that don’t have this key or should it exclude specifically the docs that don’t have this field. I am super confused about this question especially the word, “ignore”. Naturally MongoDB brings the docs that don’t have this key, so do we need to exclude them and take the final count? Does that ignore means don’t bother write specific condition to exclude them…OMG…some one help…and clarify…

usually ignore means do NOT count them.

2 Likes

Ignoring means not telling. You can use the $exists operator to know whether the key exists or does not exist in the document.

1 Like