Comment on Query in morphia

21 views
Skip to first unread message

mor...@googlecode.com

unread,
May 26, 2011, 9:36:13 PM5/26/11
to morphia...@googlegroups.com
Comment by kratos00...@gmail.com:

hi, how to force Query references with Eager?

:) sorry about my bad English

For more information:
http://code.google.com/p/morphia/wiki/Query

mor...@googlecode.com

unread,
Jun 13, 2011, 4:45:23 PM6/13/11
to morphia...@googlegroups.com
Comment by jm...@exoanalytic.com:

Let's say I want to use the fluent interface to find which {{{Person}}}s
have an {{{Address}}} is equal to {{{addr}}}:

{{{Query<Person> =
ds.createQuery(Person.class).field("address").equal(addr);}}}

How is equality determined? Is Morphia essentially confirming that
{{{addr.id}}} equals {{{Person.address.id}}}? This would imply that you
can't query for equality against an object that has not been saved the db -
is this correct? Thanks!

mor...@googlecode.com

unread,
Jul 16, 2011, 10:53:50 AM7/16/11
to morphia...@googlegroups.com
Comment by goudreau...@gmail.com:

Does the generic filter accept patterns ?

mor...@googlecode.com

unread,
Jul 16, 2011, 10:57:51 AM7/16/11
to morphia...@googlegroups.com
Comment by sc...@10gen.com:

jm..., It will compare all the fields. If you just want to match on a
single field, then use that field (using dot-notation).

mor...@googlecode.com

unread,
Jul 16, 2011, 11:01:51 AM7/16/11
to morphia...@googlegroups.com
Comment by sc...@10gen.com:

goudreau: do you mean like a regular expression?

It is best to ask questions on the group/list, please follow up there.

mor...@googlecode.com

unread,
Jul 27, 2011, 1:13:13 PM7/27/11
to morphia...@googlegroups.com
Comment by jianghai...@gmail.com:

I do not see any support for limit(), is that the case?

mor...@googlecode.com

unread,
Jul 27, 2011, 1:24:24 PM7/27/11
to morphia...@googlegroups.com
Comment by scotthernandez:

There is support for limit; I will add some docs.

mor...@googlecode.com

unread,
Oct 8, 2011, 9:17:29 PM10/8/11
to morphia...@googlegroups.com
Comment by caoxin1...@gmail.com:

(condition_A1 && condition_A2 && condition_A3) || (condition_B1 &&
condition_B2 && condition_B3) || (condition_C1 && condition_C2 &&
condition_C3)

how to use query to do?

mor...@googlecode.com

unread,
Nov 17, 2011, 5:29:05 AM11/17/11
to morphia...@googlegroups.com
Comment by xer...@gmail.com:

I've got the same problem. How to use query to do:

(condition_A1 || condition_A2 || condition_A3)
&& (condition_B1 || condition_B2 || condition_B3)
&& (condition_C1 || condition_C2 || condition_C3)

Thanks in advance

mor...@googlecode.com

unread,
Nov 22, 2011, 6:01:57 PM11/22/11
to morphia...@googlegroups.com
Comment by alexsap...@gmail.com:

How to include more than one fields in the returned data with
retrievedFields???
I mean you do query.retrievedFields(true,"field,field"); ?

mor...@googlecode.com

unread,
Nov 22, 2011, 6:36:14 PM11/22/11
to morphia...@googlegroups.com
Comment by scotthernandez:

Yes, a comma sep. list is the way.

mor...@googlecode.com

unread,
Nov 23, 2011, 6:43:34 AM11/23/11
to morphia...@googlegroups.com
Comment by alexsap...@gmail.com:

Thanks for the quick response. I don't know what i am doing wrong here?
I have a DAO to access the database.
My code id :
{{{
Query<Venue> temp = createQuery();
List<Venue> venues = temp.retrievedFields(false, "photos, Lat, Lng")....
}}}
But it return "The field 'photos, Lat, Lng' could not be found " but i have
declared them???

mor...@googlecode.com

unread,
Nov 23, 2011, 7:48:06 AM11/23/11
to morphia...@googlegroups.com
Comment by alexsap...@gmail.com:

Hi, i resolved my problem with a workaround i don't know if it is a bug or
not but it worked for me.
{{{
String _f = "photos,Lat,Lng";
String [] fields = _f.split(",");
temp = temp.retrievedFields(false, fields);
}}}
The second parameter must be an array of strings. I think that this could
be done inside the retrievedFields functions.

mor...@googlecode.com

unread,
Nov 23, 2011, 9:02:40 AM11/23/11
to morphia...@googlegroups.com
Comment by scotthernandez:

Yes, the last arg is a var arg, or String[]. I updated the docs; sorry for
the mistake.

mor...@googlecode.com

unread,
Feb 22, 2012, 3:13:57 PM2/22/12
to morphia...@googlegroups.com
Comment by kubu...@gmail.com:

hi I want to search in a map type field. For example:

p <contry,city>

q.field(p).hasAnyOf("Istanbul");

how can I do that?

ps: it's not working of course.

mor...@googlecode.com

unread,
Mar 28, 2012, 4:24:37 AM3/28/12
to morphia...@googlegroups.com
Comment by wouter...@gmail.com:

It would be nice if we could query type safe, e.g. make sure the field foo
actually exists in MyEntity.class and that operations are compatible with
this type. This probably involve some code generetion to generate a class
like 'MyEntityField' that has a field FOO and legitimate operations.

Some one can write:
ds.createQuery(MyEntity.class).filter(MyEntityField.FOO.lessThan(12)).offset(1000);
instead of:
ds.createQuery(MyEntity.class).filter("foo >", 12).offset(1000);

Any thoughts on this?

mor...@googlecode.com

unread,
Mar 28, 2012, 4:28:38 AM3/28/12
to morphia...@googlegroups.com

mor...@googlecode.com

unread,
Mar 28, 2012, 4:32:40 AM3/28/12
to morphia...@googlegroups.com
Comment by wouter...@gmail.com:

It would be nice if we could query type safe, e.g. make sure the field foo
actually exists in `MyEntity.class` and that operations are compatible with

this type. This will probably involve some code generetion to generate a

mor...@googlecode.com

unread,
Mar 28, 2012, 8:55:38 AM3/28/12
to morphia...@googlegroups.com
Comment by wouter...@gmail.com:

@Myself,

QueryDSL has a mongodb plugin that works with morphia:
http://www.querydsl.com/static/querydsl/2.1.0/reference/html/ch02s07.html

mor...@googlecode.com

unread,
Apr 5, 2012, 7:19:05 AM4/5/12
to morphia...@googlegroups.com
Comment by mvoro...@gmail.com:

I have Query that is executed without changes multiple times. Can I make
Query as a static field? in other word is Query thread-safe?

mor...@googlecode.com

unread,
May 3, 2012, 12:06:58 PM5/3/12
to morphia...@googlegroups.com
Comment by msad...@gmail.com:

I just have a question regarding 'sort' functionality. Here the sort
functions works fine for fields available in the entity. If there is a map
variable --"var1"-- in the entity(consider this map variable also a field
in the entity class) , I would like to do a sort based on a particular
key/value of this map (say i want to sort based on --var1.get("key1")--,
how do i access to the value when i use order("Field names")).

Plz help me !

thanks,
sadish

mor...@googlecode.com

unread,
Jan 26, 2013, 4:14:26 PM1/26/13
to morphia...@googlegroups.com
Comment by corybill...@gmail.com:

Any body else notice that saying .limit() does nothing to a query. The
size of the query is never effected. Is it broken????

mor...@googlecode.com

unread,
Sep 5, 2013, 5:11:56 AM9/5/13
to morphia...@googlegroups.com
Comment by itc...@gmail.com:

How to print the Query? like hibernate,the override toString method will
supply the query sql.But how morphia print the query?

For more information:
https://code.google.com/p/morphia/wiki/Query

mor...@googlecode.com

unread,
Sep 5, 2013, 5:12:56 AM9/5/13
to morphia...@googlegroups.com

mor...@googlecode.com

unread,
Jan 8, 2014, 2:40:30 PM1/8/14
to morphia...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages