Comparing version 5.5.4 to 5.6.0
@@ -22,3 +22,3 @@ var gulp = require('gulp'), | ||
dir: paths.coverageFolder, | ||
reporters: ['lcov', 'json', 'html'], | ||
reporters: ['lcovonly', 'json', 'html'], | ||
reportOpts: { dir: paths.coverageFolder } | ||
@@ -25,0 +25,0 @@ })) |
@@ -60,2 +60,6 @@ /// <reference path="../_references.d.ts" /> | ||
target.constructor.schema[name] = MongoDB.ObjectID; | ||
target.constructor.transforms[name] = { | ||
fromDB: function (value) { return value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value; }, | ||
toDB: function (value) { return value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value; } | ||
}; | ||
} | ||
@@ -62,0 +66,0 @@ exports.ObjectID = ObjectID; |
@@ -241,3 +241,3 @@ var _ = require('lodash'); | ||
Instance.schema = { | ||
_id: MongoDB.ObjectID | ||
_id: false | ||
}; | ||
@@ -249,8 +249,3 @@ Instance.validators = [ | ||
]; | ||
Instance.transforms = { | ||
_id: { | ||
fromDB: function (value) { return value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value; }, | ||
toDB: function (value) { return value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value; } | ||
} | ||
}; | ||
Instance.transforms = {}; | ||
Instance.indexes = []; | ||
@@ -257,0 +252,0 @@ return Instance; |
@@ -0,1 +1,3 @@ | ||
/// <reference path="../_references.d.ts" /> | ||
var MongoDB = require('mongodb'); | ||
var Bluebird = require('bluebird'); | ||
@@ -45,2 +47,9 @@ var _ = require('lodash'); | ||
this._indexes = instanceType.indexes || []; | ||
if (!this._schema._id) | ||
this._schema._id = MongoDB.ObjectID; | ||
if (this._schema._id === MongoDB.ObjectID && !this._transforms['_id']) | ||
this._transforms['_id'] = { | ||
fromDB: function (value) { return value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value; }, | ||
toDB: function (value) { return value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value; } | ||
}; | ||
if (instanceType.prototype instanceof Instance_1.default) | ||
@@ -47,0 +56,0 @@ this._Instance = ModelSpecificInstance_1.default(this, instanceType); |
@@ -12,6 +12,6 @@ var util = require('util'); | ||
get: function () { | ||
return model.transforms[property].fromDB(this._modified._id); | ||
return model.transforms[property].fromDB(this._modified[property]); | ||
}, | ||
set: function (value) { | ||
this._modified._id = model.transforms[property].toDB(value); | ||
this._modified[property] = model.transforms[property].toDB(value); | ||
}, | ||
@@ -18,0 +18,0 @@ enumerable: true, |
@@ -65,2 +65,6 @@ /// <reference path="../_references.d.ts" /> | ||
target.constructor.schema[name] = MongoDB.ObjectID; | ||
target.constructor.transforms[name] = { | ||
fromDB: value => value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value, | ||
toDB: value => value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value | ||
}; | ||
} |
@@ -65,3 +65,3 @@ /// <reference path="../_references.d.ts" /> | ||
static schema: Schema = { | ||
_id: MongoDB.ObjectID | ||
_id: false | ||
}; | ||
@@ -76,6 +76,3 @@ | ||
static transforms: { [property: string]: { fromDB: (value: any) => any; toDB: (value: any) => any; } } = { | ||
_id: { | ||
fromDB: value => value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value, | ||
toDB: value => value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value | ||
} | ||
}; | ||
@@ -82,0 +79,0 @@ |
@@ -64,2 +64,10 @@ /// <reference path="../_references.d.ts" /> | ||
this._indexes = instanceType.indexes || []; | ||
if(!this._schema._id) this._schema._id = MongoDB.ObjectID; | ||
if(this._schema._id === MongoDB.ObjectID && !this._transforms['_id']) | ||
this._transforms['_id'] = { | ||
fromDB: value => value._bsontype == 'ObjectID' ? new MongoDB.ObjectID(value.id).toHexString() : value, | ||
toDB: value => value && typeof value === 'string' ? new MongoDB.ObjectID(value) : value | ||
}; | ||
@@ -66,0 +74,0 @@ if ((<Function>instanceType).prototype instanceof Instance) |
@@ -18,6 +18,6 @@ /// <reference path="../_references.d.ts" /> | ||
get: function () { | ||
return model.transforms[property].fromDB(this._modified._id); | ||
return model.transforms[property].fromDB(this._modified[property]); | ||
}, | ||
set: function (value) { | ||
this._modified._id = model.transforms[property].toDB(value); | ||
this._modified[property] = model.transforms[property].toDB(value); | ||
}, | ||
@@ -24,0 +24,0 @@ enumerable: true, |
{ | ||
"name": "iridium", | ||
"version": "5.5.4", | ||
"version": "5.6.0", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1049070
175
5062