简体   繁体   English

StackMob-如何查询布尔值?

[英]StackMob - How to query for boolean values?

I saved a StackMobModel object to the server and its data appears on the stackmob site correctly. 我将StackMobModel对象保存到服务器,其数据正确显示在stackmob站点上。 I am able to query for all of the fields except for booleans (ex: new StackMobQuery().fieldIsGreaterThanOrEqualTo("age",20) ) 我可以查询除布尔值以外的所有字段(例如: new StackMobQuery().fieldIsGreaterThanOrEqualTo("age",20)

All of the query types seem to take a String for the field name and either a String or int for the value to compare against. 所有查询类型似乎都将String用作字段名,将String或int用作要比较的值。 How can I query for boolean fields? 如何查询布尔字段?

It is possible to go through the returned list and manually compare the boolean field to the desired one and create a new filtered list but this defeats the purpose of having a specific query. 可以遍历返回的列表,然后手动将布尔字段与所需的布尔字段进行比较,然后创建一个新的过滤列表,但这违背了进行特定查询的目的。

Edit: also, how do you query for longs? 编辑:另外,您如何查询多头?

Nevermind. 没关系。 What you have to do is add a StackMobQueryField via the field() method. 您要做的是通过field()方法添加一个StackMobQueryField。

.field(new StackMobQueryField("date").isGreaterThanOrEqualTo(date))

This has more options than the built-in field comparisons. 比内置字段比较具有更多的选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM