It looks like you need to initialize Ottoman with a storage target, see the following example:
var ottoman = require('ottoman');
var couchbase = require('couchbase');
var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
var bucket = cluster.openBucket('default');
ottoman.bucket = bucket;
/Users/alexander/dev/proto0/node_modules/ottoman/lib/storeadapter.js:361
var bucketMgr = this.bucket.manager();
^
TypeError: Cannot read property 'manager' of undefined
at CbStoreAdapter._ensureMrIndices (/Users/alexander/dev/proto0/node_modules/ottoman/lib/storeadapter.js:361:30)
at CbStoreAdapter.ensureIndices (/Users/alexander/dev/proto0/node_modules/ottoman/lib/storeadapter.js:450:8)
at _ensureAllStores (/Users/alexander/dev/proto0/node_modules/ottoman/lib/ottoman.js:846:17)
at handler (/Users/alexander/dev/proto0/node_modules/ottoman/lib/ottoman.js:861:9)
at handler (/Users/alexander/dev/proto0/node_modules/ottoman/lib/ottoman.js:793:7)
at /Users/alexander/dev/proto0/node_modules/ottoman/lib/storeadapter.js:289:5
at _combinedTickCallback (node.js:370:9)
at process._tickCallback (node.js:401:11)
at Function.Module.runMain (module.js:449:11)
at startup (node.js:141:18)
Which seems to be around my usage of Ottoman ‘ensureIndices’:
ottoman.ensureIndices(function(err) {
if (err) return console.error(err);
});
It looks like you have failed to set the ottoman.bucket property with an appropriate bucket object reference to use. This is causing the ensureIndices to attempt to use a null object with its method calls.
TypeError: Cannot read property ‘createIndex’ of null
at Ottoman._ensureModelIndices (/Users/Raja/server/node_modules/ottoman/lib/ottoman.js:900:17)
at _ensureAllModels (/Users/Raja/server/node_modules/ottoman/lib/ottoman.js:966:12)
at Ottoman.ensureIndices (/Users/Raja/server/node_modules/ottoman/lib/ottoman.js:969:3)
at Bucket. (/Users/Raja/server/schema/cb/CouchBaseAdapter.js:57:25)
at emitNone (events.js:110:20)
at Bucket.emit (events.js:207:7)
at Bucket. (/Users/Raja/server/node_modules/couchbase/lib/bucket.js:177:10)
myCluster = new couchbase.Cluster(‘couchbase://HOSTNAME’);
myBucket = myCluster.openBucket(‘DEFAULT’);
ottoman.store = new ottoman.CbStoreAdapter(myBucket, couchbase);
ottoman.ensureIndices(function () { });