Groups
Groups
Sign in
Groups
Groups
mongodb-user
Conversations
About
Send feedback
Help
[PHP] About $size operator in aggregate $project
113 views
Skip to first unread message
張瀚文
unread,
Aug 5, 2015, 3:06:54 AM
8/5/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hi:
I use php aggregate method to calculate group result, when I use $size operator in $project,
like the following code
array(
'$project' => array(
"action_sum" => array('$size'=>'$action')
)
),
the result as following
exception: invalid operator '$size'
I don't know what happened to my code, does any one know?
thanks a lot
PHP version is 5.5.9
reference:
http://docs.mongodb.org/manual/reference/operator/aggregation/size/
Rhys Campbell
unread,
Aug 5, 2015, 4:46:31 AM
8/5/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
What version of MongoDB are you running? The docs state $size in new in
v2.6
張瀚文
unread,
Aug 6, 2015, 3:22:25 AM
8/6/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Thank you, your reply helps me a lot, the problem was found, our version of MongoDB is v2.4, I haven't noticed this situation.
Rhys Campbell於 2015年8月5日星期三 UTC+8下午4時46分31秒寫道:
Reply all
Reply to author
Forward
0 new messages