Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
query array, not includes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
marlor  
View profile  
 More options Jan 19 2011, 6:39 pm
From: marlor <cryptose...@gmail.com>
Date: Wed, 19 Jan 2011 15:39:50 -0800 (PST)
Local: Wed, Jan 19 2011 6:39 pm
Subject: query array, not includes
hi,

i have the following structure.

{"itemId" : "item111",
  "lines" : [
        { "lineId" : "line111", "status" : { "statustype" : "AAA"} },
        { "lineId" : "line222", "status" : { "statustype" : "BBB"} }
  ]

}

{"itemId" : "item222",
  "lines" : [
        { "lineId" : "line333", "status" : { "statustype" : "AAA"} },
        { "lineId" : "line444", "status" : { "statustype" : "AAA"} }
  ]
}

{"itemId" : "item333",
  "lines" : [
        { "lineId" : "line555", "status" : { "statustype" : "CCC"} },
        { "lineId" : "line666", "status" : { "statustype" : "CCC"} }
  ]

}

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".

any suggestions?

thank you,

marlor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Scott Hernandez  
View profile  
 More options Jan 19 2011, 6:57 pm
From: Scott Hernandez <scotthernan...@gmail.com>
Date: Wed, 19 Jan 2011 15:57:45 -0800
Local: Wed, Jan 19 2011 6:57 pm
Subject: Re: [morphia] query array, not includes
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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Chen  
View profile  
 More options Sep 6 2012, 6:55 pm
From: Rick Chen <rickemi...@gmail.com>
Date: Thu, 6 Sep 2012 15:55:29 -0700 (PDT)
Local: Thurs, Sep 6 2012 6:55 pm
Subject: Re: [morphia] query array, not includes

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeremy Johnson  
View profile  
 More options Sep 14 2012, 3:43 pm
From: Jeremy Johnson <jeremy.m.john...@gmail.com>
Date: Fri, 14 Sep 2012 12:43:51 -0700 (PDT)
Local: Fri, Sep 14 2012 3:43 pm
Subject: Re: [morphia] query array, not includes

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Russell Bateman  
View profile  
 More options Sep 14 2012, 3:47 pm
From: Russell Bateman <r...@windofkeltia.com>
Date: Fri, 14 Sep 2012 13:47:55 -0600
Local: Fri, Sep 14 2012 3:47 pm
Subject: Re: [morphia] query array, not includes

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.

On 9/14/2012 1:43 PM, Jeremy Johnson wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »