Query latest version on versioned collection

16 views
Skip to first unread message

zing...@gmail.com

unread,
May 10, 2013, 4:23:29 AM5/10/13
to mor...@googlegroups.com
Hi,

I have an collection in which I store all versions to have an history.
But when I do an query on this collection, I want only to get the latest version. So I need something like

Query< Item > query = ds.createQuery( Item.class );
query.filter( "attribute.to.find", "value" );
query.field( "VERSION" ).MAX_OF_THIS_FIELD

how can I achieve this?

Marcos Eich

unread,
May 24, 2013, 10:24:11 PM5/24/13
to mor...@googlegroups.com
You can try something like this:

query.limit(1).order("version");
Reply all
Reply to author
Forward
0 new messages