Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*/
DominoConnector.prototype.replaceById = function(model, id, data, options, callback) {
let req = this._generateRequest();
// TODO: The data may include an "id" property and the value may
// be the same as the document UNID. Should we remove "id" before
// sending the PUT request?
req.put({ "uri": "/documents/unid/" + id, "json": data }, (e, r, body) => {
callback(null, body);
});
};
var Connector = require('loopback-connector').Connector;
require('util').inherits(DominoConnector, Connector);
/**
* @constructor
* Constructor for Couchbase connector
* @param {Object} client The node-mysql? client object
*/
function CouchbaseDB(settings, dataSource) {
this.name = 'couchbase';
this._models = {};
this.settings = settings;
this.dataSource = dataSource;
Connector.call(this, 'couchbase', settings);
}
require('util').inherits(CouchbaseDB, Connector);
exports.CouchbaseDB = CouchbaseDB;
/*
**************************start implementing the interface methods*****************************************
*/
CouchbaseDB.prototype.connect = function (callback) {
var self = this;
if (self.db) {
process.nextTick(function () {
callback && callback(null, self.db);
});
} else {
self.myCluster = new couchbase.Cluster(self.settings.connectUrl);
callback && callback(null, self.db);