Created
March 9, 2009 07:05
-
-
Save jcrosby/76147 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Assuming a CloudKit app hosting "notes" and "things" collections: | |
var store = $.cloudkit; | |
store.boot({ | |
success: function() { | |
// insert a 'thing' | |
store.collection('things').insert({name:"box"}, { | |
success: function(index) { | |
// do something with your data | |
} | |
}); | |
// insert a 'note' | |
store.collection('notes').insert({foo:"bar"}, { | |
success: function(index) { | |
// do something with the note | |
} | |
}); | |
// update all 'things', setting their name to "boxen". | |
// See the TaffyDB docs for the optional second "where" parameter | |
// (excluded below) specifying a subset of documents to update. | |
store.collection('things').update({name:"boxen"}, { | |
success: function(indexes) { | |
// do something with your updated data | |
} | |
}); | |
// delete all 'things' where name is "boxen". | |
store.collection('things').remove({name:"boxen"}, { | |
success: function(indexes) { | |
// your data is now removed | |
} | |
}); | |
// get all 'notes' | |
var notes = store.collection('notes').get(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment