FAQ
Hey Group,

is there a special method to count the results of the following
db.runCommand
(I transfered this to the mongo php driver)

db.runCommand( { aggregate: "cities", pipeline: [
{$match : { "days" : { $exists: true} }},
{$limit : 10000 },
{$project : {
name : 1,
sum : { $add:["$days.4", "$days.4","$days.9"] }
}},
{ $sort : { sum : -1}},
}]);

I declared a limit but often the limit is under the given limit.
I want to do some pagination with the data and need the results count.

Thanks in advance ....





--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/Vj62o-OWm6MJ.
To post to this group, send email to mongodb-user@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Search Discussions

  • Brendan W. McAdams at Apr 2, 2012 at 7:51 pm
    The results of this job will be returned in the "result" field of the
    return doc as an array. Simply count the size of that array client side.
    On Monday, 2 April 2012 06:15:41 UTC-4, mongo-php wrote:

    Hey Group,

    is there a special method to count the results of the following
    db.runCommand
    (I transfered this to the mongo php driver)

    db.runCommand( { aggregate: "cities", pipeline: [
    {$match : { "days" : { $exists: true} }},
    {$limit : 10000 },
    {$project : {
    name : 1,
    sum : { $add:["$days.4", "$days.4","$days.9"] }
    }},
    { $sort : { sum : -1}},
    }]);

    I declared a limit but often the limit is under the given limit.
    I want to do some pagination with the data and need the results count.

    Thanks in advance ....



    --
    You received this message because you are subscribed to the Google Groups "mongodb-user" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/HzobDbI_bWkJ.
    To post to this group, send email to mongodb-user@googlegroups.com.
    To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmongodb-user @
categoriesmongodb
postedApr 2, '12 at 10:55a
activeApr 2, '12 at 7:51p
posts2
users2
websitemongodb.org
irc#mongodb

2 users in discussion

Brendan W. McAdams: 1 post Mongo-php: 1 post

People

Translate

site design / logo © 2022 Grokbase