繁体   English   中英

Parse.com查询iOS上不为空的列

[英]Parse.com query for column that is not null on iOS

这应该是一个简单的任务,但是却使我感到悲伤。 我的数据库中的对象看起来像这样:

{
  "objectId": "abcdefg1",
  "comment": null
},
{
  "objectId": "abcdefg2",
  "comment": "Some text as a comment"
}

我正在尝试仅查询在iOS上具有注释文本的记录。 我正在执行以下查询:

PFQuery *query = [PFQuery queryWithClassName:@"Review"];
[query whereKeyExists:@"comment"];

当它执行时,当我期望只有一个时,会得到上面列出的两个结果。 有人可以指出我要去哪里了。 谢谢!

gh ...自然地,我只是想通了。 解决方法如下:

PFQuery *query = [PFQuery queryWithClassName:@"Review"];
[query whereKey:@"comment" notEqualTo:[NSNull null]];

这给了我一个我期望的对象。 我需要更好地注意文档。

https://parse.com/docs/ios/guide#objects-data-types

暂无
暂无

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

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