let app = Neutrino.app('{applicationId}');let collection = app.collection('cars');let realtimeObject = collection.create({
color: 'red',
year: 2016
});
let simpleObject = collection.createSimple({
color: 'blue',
year: 2015
});let realtimeObject = collection.get('{object-id}');or get simple object
let simpleObject = collection.getSimple('{object-id}');let allObjects = collection.get();or with filter
let filteredObjects = collection.get({year: 2016});Same goes for getSimple here too.
Realtime objects are updated automatically with updates from the server and local ones.
let realtimeObject = collection.get('{object-id}');
realtimeObject.year = 2014;Simple objects must be updated manually
let simpleObject = collection.getSimple('{object-id}');
simpleObject.year = 2014;
simpleObject.update();Simple objects must also manually fetch updates from the server
let simpleObject = collection.getSimple('{object-id}');
console.log(simpleObject.year); //2015
//updated on the server to 2014
simpleObject.get();
console.log(simpleObject.year); //2014The delete method works the same for both realtime and simple objects.
let object = collection.get('{object-id}');
object.delete();let realtimeArray = collection.get();
realtimeArray.forEach(object => object.delete());