var db = framework.database('some-database');
// EXAMPLE:
db.insert({ id: 101, count: 0 });
db.insert({ id: 150, count: 0 });
db.insert({ id: 151, count: 0, isDeleted: true });
db.insert({ id: 300, count: 0 });
// UPDATE
// this function reads each document in database and replaces it according returning value
db.update(function(doc) {
// current document will be removed from DB if return null or return undefined
if (doc.isDeleted)
return;
if (doc.id > 100 && doc.id < 200)
doc.count++;
if (doc.id === 300)
doc.name = 'PETER';
// current document will be replaced according returning document
return doc;
});
// OUTPUT:
// { id: 101, count: 1 }
// { id: 150, count: 1 }
// { id: 300, count: 0, name: 'PETER' }
console.log(new Date().getTime());
// or use partial.js GUID generator
console.log(utils.GUID(10));
var id = 0;
var lastest = function(doc) {
if (doc.id > id)
id = doc.id;
};
nosql.each(latest, function() {
console.log('Latest id: ', id);
});
Hi Hasan,send me your all definitions, thanks.
--
You received this message because you are subscribed to a topic in the Google Groups "partial.js - web application framework for node.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/partialjs/IDz4cvTQ4Eg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to partialjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.