Created
September 14, 2012 14:58
-
-
Save KellyRice/3722440 to your computer and use it in GitHub Desktop.
Kinvey Save Related Entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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