
var gumbo = require("gumbo");
var col = gumbo.collection([
{
name: "craig",
age: 99
},
{
name: "tim",
age: 104
}
}
]);
col.find({ age: { $gt: 100 } }).limit(10).skip(1).sort({ age: -1 }).exec(function(err, people) {
});
//watching
col.watch({ age: {$gt: 100 } }, {
insert: function(item) {
console.log("insert %s", item.get("_id"));
},
update: function(item) {
},
remove: function(item) {
}
});
creates a new collection
source - the source for the collection.
modelClass - the model class for the source.
watches the collection for any particular changes
synchronizes the data from one collection to another collection
basic example:
//update, and return the modified items
collection.update({ name: "craig" }, { $set: { age: 55 }}).capture().exec(function(err, modifiedItems) {
});
defines the chunk size when executing asynchronous tasks
captures any found / modified items
executes the iterator asynchronously
exetures the iterator synchronously, and returns the result
Copyright 2013 - present © cnpmjs.org | Home |