0

With below code:

var Photo = Parse.Object.extend("Photo");

 var query = new Parse.Query(Photo);
 query.equalTo("owner", Parse.User.current());
 query.limit(1000);
 query.descending("takenAt");
 query.include("galleries");

 query.find({ 
   success: function(results) {
     // results has the list of users with a hometown team with a winning record
     console.log(results);
     res.render("photos", { photos : results,user:Parse.User.current(),nav:req.originalUrl });
   },
   error: function(error) {
     console.log(error);
   }
 });

I get error: {"code":102,"message":"field galleries cannot be included because it is not a pointer to another object"}

This galleries field is an array of pointers. An example from the data browser: [{"__type":"Pointer","className":"Gallery","objectId":"hXFwm8yrRT"}]

I have found numerous posts saying this should be correct - Why is it not working?

1

1 Answer 1

1

I was looking deep into the data and found that some objects had null values inside the array. Since these null values are indeed not pointers to Parse Objects, the Parse servers apparently reject includes if any requested array of pointer fields contain null values in the array.

Not a very graceful error, and would be nice to have this behavior shown in the documentation.

I hope this helps someone who might have a similar issue in the future.

Sign up to request clarification or add additional context in comments.

1 Comment

did you happen to find a solution to figure out how to catch the "null" objects? When i checked for nullity by doing if(obj != null), it wouldn't work. Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.