Count After Skip MongoDb -
I have such a collection
{"_id": ObjectId ("54368d9125c3dc7c1f43295f") "Nome": "John", "Eta": 30, "Data": ISOAD ("2014-10-09T10: 30: 00.000Z"}} {"_id": ObjectID ("54368d9c25c3dc7c1f432960"), "Nom" "Paul", "Eta": 31} and I do this query
db.coll.find ({eta: {$ gt: 30}}) My result is a document (Paul)
db.coll.find ({eta: {$ gt: 30}}) .count () // 1 If I do
db.coll.find ({eta: {$ gt: 30}}). Skip (1) I do not have the results, and it's okay. But if I do this
db.coll.find ({eta: {$ gt: 30}}. Skip (1) .count () < P> My result is 1
From the document for:
By default, the Count () method ignores the effects of the cursor. Skip () and cursor.Limit (). Set the SQL Limit to consider the effect of these methods. < P> then you can supply an alternative parameter called applySkipLimit to apply (code). They are, if you want to effect it (): ( < / P> .count (true);
Comments
Post a Comment