views:

18

answers:

1

Let's say there is:

{username : "tom1", address : { type : 0, year : 2001 }}
{username : "tom2", address : { type : 1, year : 2011 }}
{username : "tom3", address : { type : 0, year : 2031 }}
{username : "tom4", address : { type : 1, year : 2002 }}

I'm using Java Driver, how can I query: users who's address.type = 1 AND address.year > 2010 ?

Notice it is in the address object, so normal query {address.type : 1, address.year : {$gt : 2010}} does not work at all.

Thank you!

+1  A: 

Oh I got it:

{address : {type : 1, year : {$gt : 2010}}}
Ben