The default operator between array elements in MongoDB is $and, as such you
can actually remove those $and's and use only the $or. Also you cannot have
duplicate array keys within a single array as such only one $and would be
seen anyway.
On 2 November 2012 10:47, Jay Prakash Mishra <jayprakas...@gmail.com> wrote:
> Fatal error: Uncaught exception 'MongoCursorExc**eption' with message
> '$and expression must be a nonempty array' ...............................
> Please help me.
> Regards
> Jay
> --
> 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
> See also the IRC channel -- freenode.net#mongodb
On Fri, Nov 2, 2012 at 5:36 PM, Sam Millman <sam.mill...@gmail.com> wrote:
> The default operator between array elements in MongoDB is $and, as such you
> can actually remove those $and's and use only the $or. Also you cannot have
> duplicate array keys within a single array as such only one $and would be
> seen anyway.
> On 2 November 2012 10:47, Jay Prakash Mishra <jayprakas...@gmail.com> wrote:
>> Dear Friend,
>> I need a customize query criteria for find method. My condition of query
>> is like below :
>> Mysql Query :
>> Select * from students where (state='xx' and city='yy') OR
>> (university='mm' and college='nn').
>> Please provide above query in mongodb. However I tried to write this in
>> Mongo as below :
>> Fatal error: Uncaught exception 'MongoCursorException' with message '$and
>> expression must be a nonempty array' ...............................
>> Please help me.
>> Regards
>> Jay
>> --
>> 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
>> See also the IRC channel -- freenode.net#mongodb
> --
> 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
> See also the IRC channel -- freenode.net#mongodb
-- Thanks & Regards
Jay Prakash | Software Engineer
M. N. - 9953477708
You've got a few too many arrays there, the syntax for an $or is $or =>
array(array(//condition), array(//condition)) with the condition parts
being $and and the sub arrays in the $or array being $or
On 2 November 2012 12:17, Jay Prakash Mishra <jayprakas...@gmail.com> wrote:
> On Fri, Nov 2, 2012 at 5:36 PM, Sam Millman <sam.mill...@gmail.com> wrote:
> > The default operator between array elements in MongoDB is $and, as such
> you
> > can actually remove those $and's and use only the $or. Also you cannot
> have
> > duplicate array keys within a single array as such only one $and would be
> > seen anyway.
> > On 2 November 2012 10:47, Jay Prakash Mishra <jayprakas...@gmail.com>
> wrote:
> >> Dear Friend,
> >> I need a customize query criteria for find method. My condition of query
> >> is like below :
> >> Mysql Query :
> >> Select * from students where (state='xx' and city='yy') OR
> >> (university='mm' and college='nn').
> >> Please provide above query in mongodb. However I tried to write this in
> >> Mongo as below :
> >> Fatal error: Uncaught exception 'MongoCursorException' with message
> '$and
> >> expression must be a nonempty array' ...............................
> >> Please help me.
> >> Regards
> >> Jay
> >> --
> >> 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
> >> See also the IRC channel -- freenode.net#mongodb
> > --
> > 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
> > See also the IRC channel -- freenode.net#mongodb
> --
> Thanks & Regards
> Jay Prakash | Software Engineer
> M. N. - 9953477708
> --
> 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
> See also the IRC channel -- freenode.net#mongodb