How can I query all items which do not have all of its
lines.status.statustype AAA.
In case of statustype AAA, with the above sample, I want to retrieve
item with itemId item111 and item333. NOT item222 as both of it's
statustype is AAA.
Note: there can be more than two lines per item.
I tried the different query methods notEquals, hasNonOf ... but it
looks like they are not the implementation i am looking for as in this
case i am searching for fields within an array "lines".
I think you want $not + $all; however I don't think we can express that with the current fluent query system.
See if you can get what you want via the shell and I will see if that can be represented with the current system, and if not we can add an issue to support it.
> How can I query all items which do not have all of its > lines.status.statustype AAA. > In case of statustype AAA, with the above sample, I want to retrieve > item with itemId item111 and item333. NOT item222 as both of it's > statustype is AAA. > Note: there can be more than two lines per item.
> I tried the different query methods notEquals, hasNonOf ... but it > looks like they are not the implementation i am looking for as in this > case i am searching for fields within an array "lines".
On Wednesday, January 19, 2011 3:57:45 PM UTC-8, Scott Hernandez wrote:
> I think you want $not + $all; however I don't think we can express > that with the current fluent query system.
> See if you can get what you want via the shell and I will see if that > can be represented with the current system, and if not we can add an > issue to support it.
> On Wed, Jan 19, 2011 at 3:39 PM, marlor <crypt...@gmail.com <javascript:>> > wrote: > > hi,
> > How can I query all items which do not have all of its > > lines.status.statustype AAA. > > In case of statustype AAA, with the above sample, I want to retrieve > > item with itemId item111 and item333. NOT item222 as both of it's > > statustype is AAA. > > Note: there can be more than two lines per item.
> > I tried the different query methods notEquals, hasNonOf ... but it > > looks like they are not the implementation i am looking for as in this > > case i am searching for fields within an array "lines".
Just to better my understanding of Morphia, if a query such as this isn't supported by Morphia we still have the option of using the Java driver for the query and then using Morphia for the DBObject -> POJO mapping, right?
On Thursday, September 6, 2012 6:55:30 PM UTC-4, Rick Chen wrote:
> Hi Scott,
> I need the $not + $all in this query: > *{"myInts":{$not:{$all:[1,2]}}}*
> Here's the Java code: > List<Integer> ints = new ArrayList<Integer>(); > ints.add(1); > ints.add(2); > Query q = createQuery().field("myInts").not.hasAll(ints);
> This creates this instead: > *{"myInts":{"$all":{"$not":{"$not":[1,2]}}}}*
> How do I create the original query above through Morphia?
> Thanks, > Rick
> On Wednesday, January 19, 2011 3:57:45 PM UTC-8, Scott Hernandez wrote:
>> I think you want $not + $all; however I don't think we can express >> that with the current fluent query system.
>> See if you can get what you want via the shell and I will see if that >> can be represented with the current system, and if not we can add an >> issue to support it.
>> On Wed, Jan 19, 2011 at 3:39 PM, marlor <crypt...@gmail.com> wrote: >> > hi,
>> > How can I query all items which do not have all of its >> > lines.status.statustype AAA. >> > In case of statustype AAA, with the above sample, I want to retrieve >> > item with itemId item111 and item333. NOT item222 as both of it's >> > statustype is AAA. >> > Note: there can be more than two lines per item.
>> > I tried the different query methods notEquals, hasNonOf ... but it >> > looks like they are not the implementation i am looking for as in this >> > case i am searching for fields within an array "lines".
In my DAO layer, I use both Morphia and, for stuff I haven't figured out how to do in Morphia, direct calls to the Java driver. The Mongo code in my project (switch EVERYTHING over from PostgreSQL) is now over 4 months old.
> Just to better my understanding of Morphia, if a query such as this > isn't supported by Morphia we still have the option of using the Java > driver for the query and then using Morphia for the DBObject -> POJO > mapping, right?
> Thanks.
> On Thursday, September 6, 2012 6:55:30 PM UTC-4, Rick Chen wrote:
> Hi Scott,
> I need the $not + $all in this query:
> *{"myInts":{$not:{$all:[1,2]}}}*
> Here's the Java code:
> List<Integer> ints = new ArrayList<Integer>();
> ints.add(1);
> ints.add(2);
> Query q = createQuery().field("myInts").not.hasAll(ints);
> This creates this instead:
> *{"myInts":{"$all":{"$not":{"$not":[1,2]}}}}*
> How do I create the original query above through Morphia?
> Thanks,
> Rick
> On Wednesday, January 19, 2011 3:57:45 PM UTC-8, Scott Hernandez
> wrote:
> I think you want $not + $all; however I don't think we can express
> that with the current fluent query system.
> See if you can get what you want via the shell and I will see
> if that
> can be represented with the current system, and if not we can
> add an
> issue to support it.
> On Wed, Jan 19, 2011 at 3:39 PM, marlor <crypt...@gmail.com>
> wrote:
> > hi,
> > How can I query all items which do not have all of its
> > lines.status.statustype AAA.
> > In case of statustype AAA, with the above sample, I want to
> retrieve
> > item with itemId item111 and item333. NOT item222 as both of
> it's
> > statustype is AAA.
> > Note: there can be more than two lines per item.
> > I tried the different query methods notEquals, hasNonOf ...
> but it
> > looks like they are not the implementation i am looking for
> as in this
> > case i am searching for fields within an array "lines".