MCPcopy Create free account
hub / github.com/dresende/node-orm2 / Driver

Function Driver

lib/Drivers/DML/mongodb.js:9–23  ·  view source on GitHub ↗
(config, connection, opts)

Source from the content-addressed store, hash-verified

7exports.Driver = Driver;
8
9function Driver(config, connection, opts) {
10 this.client = new mongodb.MongoClient();
11 this.db = null;
12 this.config = config || {};
13 this.opts = opts;
14
15 if (!this.config.timezone) {
16 this.config.timezone = "local";
17 }
18
19 this.opts.settings.set("properties.primary_key", "_id");
20 this.opts.settings.set("properties.association_key", function (name, field) {
21 return name + "_" + field.replace(/^_+/, '');
22 });
23}
24
25Driver.prototype.sync = function (opts, cb) {
26 this.db.createCollection(opts.table, function (err, collection) {

Callers

nothing calls this directly

Calls 1

setMethod · 0.65

Tested by

no test coverage detected