最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Retrieve all objects that have a column that does not equal to undefined - Stack Overflow

programmeradmin5浏览0评论


I want to retrieve two objects with title cc and bb above.
My code:

var Item = Parse.Object.extend('Item');
var query = new Parse.Query(Item);
query.notEqualTo('parentItem',undefined);
query.find().then(function(subItems){
    console.log(subItems);
},function(error){
    console.log(error.code+': '+error.message);
});

The error is 102: pointer field parentItem needs a pointer value
Any help is really appreciate.


I want to retrieve two objects with title cc and bb above.
My code:

var Item = Parse.Object.extend('Item');
var query = new Parse.Query(Item);
query.notEqualTo('parentItem',undefined);
query.find().then(function(subItems){
    console.log(subItems);
},function(error){
    console.log(error.code+': '+error.message);
});

The error is 102: pointer field parentItem needs a pointer value
Any help is really appreciate.

Share Improve this question asked Jan 18, 2016 at 10:53 phuwinphuwin 3,2705 gold badges27 silver badges49 bronze badges 1
  • Change undefined to null and it will work. – phuwin Commented Jan 18, 2016 at 11:04
Add a ment  | 

2 Answers 2

Reset to default 4

Use Parse.Query.exists(key)

var Item = Parse.Object.extend('Item');
var query = new Parse.Query(Item);
query.exists('parentItem');
query.find().then(function(subItems){
   console.log(subItems);
},function(error){
   console.log(`${error.code}: ${error.message}`;
});

Change undefined to null and it will work

var Item = Parse.Object.extend('Item');
var query = new Parse.Query(Item);
query.notEqualTo('parentItem',null);
query.find().then(function(subItems){
    console.log(subItems);
},function(error){
    console.log(error.code+': '+error.message);
});
发布评论

评论列表(0)

  1. 暂无评论