Comparing version 1.4.12 to 1.4.13
{ | ||
"name": "mongot", | ||
"version": "1.4.12", | ||
"version": "1.4.13", | ||
"description": "MongoT is a modern ODM library for MongoDb.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -25,2 +25,17 @@ "use strict"; | ||
return new schema_1.ObjectID(value); | ||
case schema_1.Long: | ||
if (value instanceof schema_1.Long) { | ||
return value; | ||
} | ||
if (typeof value === 'number') { | ||
return schema_1.Long.fromNumber(value); | ||
} | ||
else if (typeof value === 'string') { | ||
return schema_1.Long.fromString(value); | ||
} | ||
else if (typeof value === 'object' && '_bsontype' in value) { | ||
return schema_1.Long.fromBits(value['low_'], value['high_']); | ||
} | ||
// @TODO Think how to do with that unexpected behavior | ||
return null; | ||
case String: | ||
@@ -55,2 +70,5 @@ return TypeCast.castToString(value); | ||
} | ||
if (value instanceof schema_1.Long) { | ||
return value.toJSON(); | ||
} | ||
if (value instanceof SchemaMetadata) { | ||
@@ -83,2 +101,5 @@ return value.toObject(); | ||
} | ||
if (value instanceof schema_1.ObjectID || value instanceof schema_1.Long) { | ||
return value; | ||
} | ||
if (value instanceof SchemaMetadata) { | ||
@@ -85,0 +106,0 @@ return value.extract(); |
@@ -33,2 +33,2 @@ import "./reflect"; | ||
export declare const virtual: (target: any, propertyKey: string | symbol) => void; | ||
export { ObjectID } from 'mongodb'; | ||
export { ObjectID, Long } from 'mongodb'; |
@@ -110,2 +110,3 @@ "use strict"; | ||
exports.ObjectID = mongodb_1.ObjectID; | ||
exports.Long = mongodb_1.Long; | ||
//# sourceMappingURL=schema.js.map |
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
138321
1963