Skip to content

Instantly share code, notes, and snippets.

@KellyRice
Created September 14, 2012 14:58
Show Gist options
  • Save KellyRice/3722440 to your computer and use it in GitHub Desktop.
Save KellyRice/3722440 to your computer and use it in GitHub Desktop.
Kinvey Save Related Entities
// Create an author and book entity.
var author = new Kinvey.Entity({ name: 'Joanne Rowling' }, 'authors');
var book = new Kinvey.Entity({ title: 'Harry Potter and the half-blood Prince', author: author }, 'books');
// Save both.
book.save({
success: function(book) {
// book is the book entity instance.
// book.get('author') is the author entity instance.
},
error: function() {
// An error occurred.
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment