On Sun, Apr 22, 2012 at 6:09 AM, Earthson <earthson.la...@gmail.com> wrote: > for document {'a':(1,2,3), '_id':Object(xxxx...)}, how could I get the size > of 'a'. > I do not find a way to do this, someone help~
> --
> Perfection is achieved > not when there is nothing more to add > but when there is nothing left to take away
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > 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.
On Sun, Apr 22, 2012 at 6:39 PM, Earthson <earthson.la...@gmail.com> wrote: > for document {'a':(1,2,3), '_id':Object(xxxx...)}, how could I get the > size of 'a'. > I do not find a way to do this, someone help~
> --
> Perfection is achieved > not when there is nothing more to add > but when there is nothing left to take away
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > 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.
> wrote: > I am not sure about the exact way of getting the size or length of the > array. but this is similar what you asking.
> db.collection.find({a:{$size:3}});
> this will match document which has the array size of 3
> Thanks!
> On Sun, Apr 22, 2012 at 6:39 PM, Earthson <earthson.la...@gmail.com>wrote:
>> for document {'a':(1,2,3), '_id':Object(xxxx...)}, how could I get the >> size of 'a'. >> I do not find a way to do this, someone help~
>> --
>> Perfection is achieved >> not when there is nothing more to add >> but when there is nothing left to take away
>> -- >> You received this message because you are subscribed to the Google Groups >> "mongodb-user" group. >> 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.
> -- > Asoka Sampath Edussooriya
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > 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.
--
Perfection is achieved not when there is nothing more to add but when there is nothing left to take away
On Sun, Apr 22, 2012 at 7:38 AM, Earthson <earthson.la...@gmail.com> wrote: > May be I should add an extra field to count the length(with limit > operations, not addToSet). > thx~
> On Sun, Apr 22, 2012 at 9:58 PM, Asoka Sampath Edussooriya > <eas...@gmail.com> wrote:
>> I am not sure about the exact way of getting the size or length of the >> array. but this is similar what you asking.
>> db.collection.find({a:{$size:3}});
>> this will match document which has the array size of 3
>> Thanks!
>> On Sun, Apr 22, 2012 at 6:39 PM, Earthson <earthson.la...@gmail.com> >> wrote:
>>> for document {'a':(1,2,3), '_id':Object(xxxx...)}, how could I get the >>> size of 'a'. >>> I do not find a way to do this, someone help~
>>> --
>>> Perfection is achieved >>> not when there is nothing more to add >>> but when there is nothing left to take away
>>> -- >>> You received this message because you are subscribed to the Google Groups >>> "mongodb-user" group. >>> 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.
>> -- >> Asoka Sampath Edussooriya
>> -- >> You received this message because you are subscribed to the Google Groups >> "mongodb-user" group. >> 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.
> --
> Perfection is achieved > not when there is nothing more to add > but when there is nothing left to take away
> -- > You received this message because you are subscribed to the Google Groups > "mongodb-user" group. > 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.