Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/adapters/level/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ try {
level = utils.file.requireLocal('level');
} catch(e) {}

try {
// Next, try LevelUp
level = utils.file.requireLocal('levelup');
} catch(e) {}

try {
// Finally, multilevel
multilevel = utils.file.requireLocal('multilevel');
Expand Down
18 changes: 5 additions & 13 deletions lib/adapters/mongo/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var model = require('../../index')
, mongo
, MongoClient
, utils = require('utilities')
, operation = require('../../query/operation')
, comparison = require('../../query/comparison')
Expand All @@ -12,7 +12,7 @@ var model = require('../../index')
, _collectionizeModelName;

// DB lib should be locally installed in the consuming app
mongo = utils.file.requireLocal('mongodb', model.localRequireError)
MongoClient = utils.file.requireLocal('mongodb', model.localRequireError)

_baseConfig = {
username: null
Expand Down Expand Up @@ -64,8 +64,6 @@ var Adapter = function (options) {
this.name = 'mongo';
this.config = this.loadConfig(_baseConfig, opts);
this.client = null;

this.init.apply(this, arguments);
};

Adapter.prototype = new BaseAdapter();
Expand Down Expand Up @@ -189,22 +187,17 @@ utils.mixin(Adapter.prototype, new (function () {
return ret;
};

this.init = function () {
var config = this.config
, server = new mongo.Server(config.host, config.port);
this.client = new mongo.MongoClient(server, config);
};

this.connect = function (callback) {
var self = this
, cb = callback || function () {};
this.client.connect(_generateConnectionUrl(self.config), function (err, db) {
MongoClient.connect(_generateConnectionUrl(self.config), function (err, client) {
if (err) {
self.emit('error', err);
cb(err);
}
else {
self.client._db = db;
self.client = client;
self.client._db = client.db(self.config.dbname);
self.emit('connect');
cb();
}
Expand Down Expand Up @@ -450,4 +443,3 @@ utils.mixin(Adapter.prototype, new (function () {
})());

module.exports.Adapter = Adapter;

Loading