How to use ottoman - 5 common examples

To help you get started, we’ve selected a few ottoman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ToddGreenstein / try-cb-nodejs / model / db.js View on Github external
}, function (err, responseB, bodyB) {
                if (err) {
                    console.log("ENVIRONMENT: COUCHBASE",endPoint, "NOT RESPONDING");
                    if (config.application.verbose) {
                        console.log("--↳ VERBOSE:ERR", err);
                    }
                    done(false);
                    return;
                }
                if(responseB.statusCode!=404) {
                    if (parseInt(JSON.parse(bodyB).basicStats.itemCount) > config.couchbase.thresholdItemCount) {
                        myBucket = myCluster.openBucket(bucket);
                        db = myBucket;
                        ODMBucket = myCluster.openBucket(bucket);
                        ottoman.store.bucket = ODMBucket;
                        // console.log("ENVIRONMENT: SERVICES: CHECK INDEXES ONLINE");
                        query("CREATE INDEX temp ON `" + config.couchbase.bucket + "`(non) USING " + config.couchbase.indexType,
                              function (err, res) {
                                  if (err) {
                                      console.log("ENVIRONMENT: INDEX QUERY NOT RESPONDING");
                                      done(false);
                                      return;
                                  }
                                  if (res) {
                                      query('SELECT COUNT(*) FROM system:indexes WHERE state="online"',
                                            function (err, onlineCount) {
                                                if (err) {
                                                    console.log("ENVIRONMENT: INDEX QUERY NOT RESPONDING");
                                                    done(false);
                                                    return;
                                                }
github ToddGreenstein / try-cb-nodejs / model / flight.js View on Github external
var db = require('./../utils/db');
var ottoman = require('ottoman');
ottoman.bucket = db.ODMBucket;

var FlightMdl = ottoman.model('Flight', {
    name: 'string',
    flight: 'string',
    date:'string',
    sourceairport:'string',
    destinationairport:'string',
    bookedon:'string'
});

module.exports=FlightMdl;
github ToddGreenstein / try-cb-nodejs / model / user.js View on Github external
var db = require('./../utils/db');
var ottoman = require('ottoman');
ottoman.bucket = db.ODMBucket;
var Flight=require('./flight');

var UserMdl = ottoman.model('User', {
    name: 'string',
    password: 'string',
    token:'string',
    flights:'Mixed'
}, {
    index: {
        findByName: {
            type: 'refdoc',
            by: 'name'
        }
    }
});
github ToddGreenstein / try-cb-nodejs / model / user.js View on Github external
var db = require('./../utils/db');
var ottoman = require('ottoman');
ottoman.bucket = db.ODMBucket;
var Flight=require('./flight');

var UserMdl = ottoman.model('User', {
    name: 'string',
    password: 'string',
    token:'string',
    flights:'Mixed'
}, {
    index: {
        findByName: {
            type: 'refdoc',
            by: 'name'
        }
    }
});

UserMdl.prototype.addflights = function (newFlights, done) {
    if (typeof this.flights.length === 'undefined') {
        this.flights = [];
github ToddGreenstein / try-cb-nodejs / model / flight.js View on Github external
var db = require('./../utils/db');
var ottoman = require('ottoman');
ottoman.bucket = db.ODMBucket;

var FlightMdl = ottoman.model('Flight', {
    name: 'string',
    flight: 'string',
    date:'string',
    sourceairport:'string',
    destinationairport:'string',
    bookedon:'string'
});

module.exports=FlightMdl;

ottoman

Ottoman Couchbase ODM

Apache-2.0
Latest version published 5 months ago

Package Health Score

73 / 100
Full package analysis