I am building an AngularJS CRUD site to add data to Parse.com to be used by mobile apps that will read it. (The CRUD is easier to do on a real keyboard due to the amount of data added.) First step is to create and save the Child objects (Ingredients and Steps), and then to create and save a Recipe object that has a Relation to the Ingredients and Steps. I need to use Relation and not Pointers for these. (because I may need this to be many to many in future)
Here's my problem: writing the query to find any Ingredients and Steps that were created that are NOT yet part of a relation, to find the ones to be added to a new recipe.
The examples in the Javascript SDK don't show this scenario, they only show a query for a relation that exists, but does not have an additional attribute on the related item (comments for posts where post doesn't have an image).
Recipe has ingredients, a Relation<Ingredient>, and steps, a Relation<Step>.
This doesn't work to get the Ingredients that are not yet related to a Recipe.
var Recipe = Parse.Object.extend("Recipe");
var Ingr = Parse.Object.extend("Ingredient");
recipeQuery= new Parse.Query(Recipe);
recipeQuery.exists("ingredients");
query = new Parse.Query(Ingr);
query.doesNotMatchQuery("recipe",recipeQuery);
query.ascending('name');
query.find({
success: function (data) {
if (data.length > 0) {
$scope.loadingMsg = '';
}
$scope.ingredients = data;
}
});