簡體   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