The cursor.count()
method's applySkipLimit
boolean parameter is documented as follows:
... Specifies whether to consider the effects of the
cursor.skip()
andcursor.limit()
methods in the count. ... SetapplySkipLimit
totrue
to consider the effect of these methods.
Meanwhile, the cursor.size()
method is documented as follows:
Returns: A count of the number of documents that match the
db.collection.find()
query after applying anycursor.skip()
andcursor.limit()
methods.
This makes it sound as though cursor.count(true)
and cursor.size()
have identical behaviour, yet the docs for some reason neither confirm or disconfirm this explicitly, and it would seem to be an odd design decision to provide both if they behave identically. Are these two expressions, in fact, equivalent, or is there a subtle difference?