- Home /
(Parse.com) Retrieve data from a Parse Query?
Hello, I'm looking for how to query a Parse database and return all levels made by a User. The "author" field in the Levels database is a pointer however so I have to use the userObj line below. I can't seem to read back the ParseObject list that's returned. It gets to the "Before Loop" console output, but it won't run the foreach code at all. Any ideas on why this is? I also tested whether results was null right before the loop and it isn't. I've also posted this on the Parse google group and stackoverflow and received no replies, so I thought I'd try here.
string author = "null";
ParseObject userObj = ParseObject.CreateWithoutData("_Users","username");
var query = ParseObject.GetQuery("Levels")
.WhereEqualTo("author", userObj);
//query = query.Include("author");
var queryTask = query.FindAsync();
while (!queryTask.IsCompleted) yield return null;
IEnumerable<ParseObject> results = queryTask.Result;
Debug.Log ("Before Loop");
foreach (var obj in results) {
Debug.Log ("In Loop!");
author = obj.Get<string>("username");
Debug.Log ("Author: " + author);
Debug.Log("levelname: " + obj["levelName"]);
}
Comment