We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Welcome to the node-ottoman wiki!
npm install couchbase
npm install node-uuid
npm install underscore
npm install ottoman
The following requires that you have a bucket in Couchbase called "test".
We associate an object called User with the database, add some data to it, persist is to Couchbase and then prove that it's there by doing a find.
var Ottoman = require('/Users/marc/Code/node-ottoman/lib/ottoman'); var couchbase = require('couchbase'); var uuid = require('node-uuid'); var User = Ottoman.model('User', { 'username': 'string', 'name': 'string', 'email': 'string' },{ bucket: new couchbase.Connection({bucket: 'default'}) }); var test = new User(); test.username = 'brett19'; test.name = 'Brett Lawson'; test.email = 'brett19@gmail.com'; Ottoman.save(test, function(err) { if (err) throw err; User.findById(test._id, function(err, obj) { if (err) throw err; console.log(obj.name); // Brett Lawson }); });