.save()

Writes the cached data into the collection's JSON file.

This method must be used if you set autoSave to false when creating the database, otherwise you should not use it.

save()

// Note: Users is a collection.

Users.get(); // [{ id: 1, name: 'Peter' }]

Users.create({ id: 2, name: 'Michael' }); // { id: 2, name: 'Michael' }

Users.get(); // [{ id: 1, name: 'Peter' }, { id: 2, name: 'Michael' }] (cached only)
Users.fetch(); // [{ id: 1, name: 'Peter' }]

Users.save();

Users.get(); // [{ id: 1, name: 'Peter' }, { id: 2, name: 'Michael' }] (cached and written in the JSON file)  
Users.fetch(); // [{ id: 1, name: 'Peter' }, { id: 2, name: 'Michael' }]

Last updated