updateData
Updates a record in the collection.
function(instanceData)
Updates a record given the serialized form of the data. Returns a promise that resolves to a object that contains the new properties and values of the record.
An example request and response might look like:
connection.updateData( {
id: 5,
name: "do dishes",
createdAt: 1477104548997
} ).then( function( instanceData ) {
instanceData; //-> {
// id: 5,
// name: "do dishes",
// createdAt: 1477104540000,
// updatedAt: 1477104580000
//}
} );
The following shows how constructor calls updateData
and what it does with the response:
// get its raw data
const instanceData = connection.serializeInstance( myInstance );
connection.updateData( instanceData ).then( function( updatedInstanceData ) {
connection.updatedInstance( myInstance, updatedInstanceData );
} );
Parameters
- instanceData
{Object}
:The serialized data of the instance.
Returns
{Promise<Object>}
:
A promise resolved with the updated data of the newly created instance.
By default, updatedInstance deletes properties in myInstance
that are not in updatedInstanceData
. To change that behavior, overwrite updatedInstance.