Created
February 21, 2015 22:27
-
-
Save cnandreu/52807b2b11f136866360 to your computer and use it in GitHub Desktop.
Code used in the "MobileFirst Platform v6.3 JSONStore CLI Installation" Youtube Video (https://www.youtube.com/watch?v=OndEumD9VMs&hd=1)
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
function wlCommonInit () { | |
var collectionName = 'people'; | |
var collections = { | |
people : { | |
searchFields : {name: 'string', age: 'integer'} | |
} | |
}; | |
var options = { | |
username : 'username', | |
password : '123' | |
}; | |
WL.JSONStore.init(collections, options) | |
.then(function () { | |
return WL.JSONStore.get(collectionName).add({name: 'carlos', age: 10}); | |
}) | |
.then(function (numberOfDocumentsAdded) { | |
console.log('Added: ' + numberOfDocumentsAdded); | |
return WL.JSONStore.get(collectionName).findAll(); | |
}) | |
.then(function (findResults) { | |
console.log('Find results:' + JSON.stringify(findResults, null, ' ')); | |
}) | |
.fail(function (errorObject) { | |
console.log('Failure: ' + errorObject.toString()); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment