Closed mocheng closed 11 years ago
@mocheng Sorry for the delayed response -- I never got an email about this!
The documentation is friendly: db().open(host,port)
If you are a newb to things, here is a fully functional example: (please make sure MongoDB is already running) (please make sure you have appropriately installed mongous)
var $ = require("mongous").Mongous,
db = 'theory.state',
val = {way:'index'};
$().open('localhost', 27017);
$(db).save(val);
$(db).find({},function(r){
console.log("saved");
console.log(r);
$(db).remove(val);
$(db).find({},function(r){
console.log("remove");
console.log(r);
});
});
I hope this helps!
The sample code doesn't tell how to specify hostname and port number. It would be much helpful to have a complete example code.