morphia中查询时,如何使用关键字“in”的条件

小米粥 发布于 2011/08/16 20:05
阅读 1K+
收藏 0
用个sql来举例,比如
select * from test where ID in (25,35,45)
用morphia怎么来写?
加载中
0
小米粥
小米粥

Create a filter based on the specified condition and value.

Note: Property is in the form of "name op" ("age >").

Valid operators are ["=", "==","!=", "<>", ">", "<", ">=", "<=", "in", "nin", "all", "size", "exists"]

Examples:

  • filter("yearsOfOperation >", 5)
  • filter("rooms.maxBeds >=", 2)
  • filter("rooms.bathrooms exists", 1)
  • filter("stars in", new Long[]{3,4}) //3 and 4 stars (midrange?)
  • filter("age >=", age)
  • filter("age =", age)
  • filter("age", age) (if no operator, = is assumed)
  • filter("age !=", age)
  • filter("age in", ageList)
  • filter("customers.loyaltyYears in", yearsList)
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部