bson
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -25,3 +25,3 @@ { | ||
], | ||
"version": "4.0.0" | ||
"version": "4.0.1" | ||
} |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="4.0.1"></a> | ||
## [4.0.1](https://github.com/mongodb/js-bson/compare/v4.0.0...v4.0.1) (2018-12-06) | ||
### Bug Fixes | ||
* **object-id:** correct serialization of old ObjectID types ([8d57a8c](https://github.com/mongodb/js-bson/commit/8d57a8c)) | ||
<a name="4.0.0"></a> | ||
@@ -7,0 +17,0 @@ # [4.0.0](https://github.com/mongodb/js-bson/compare/v3.0.2...v4.0.0) (2018-11-13) |
@@ -5,2 +5,3 @@ 'use strict'; | ||
let randomBytes = require('./parser/utils').randomBytes; | ||
const deprecate = require('util').deprecate; | ||
@@ -65,3 +66,3 @@ // constants | ||
// Generate a new id | ||
this.id = this.generate(id); | ||
this.id = ObjectId.generate(id); | ||
// If we are caching the hex string | ||
@@ -143,3 +144,3 @@ if (ObjectId.cacheHexString) this.__id = this.toString('hex'); | ||
*/ | ||
get_inc() { | ||
static getInc() { | ||
return (ObjectId.index = (ObjectId.index + 1) % 0xffffff); | ||
@@ -149,13 +150,2 @@ } | ||
/** | ||
* Update the ObjectId index used in generating new ObjectId's on the driver | ||
* | ||
* @method | ||
* @return {number} returns next index value. | ||
* @ignore | ||
*/ | ||
getInc() { | ||
return this.get_inc(); | ||
} | ||
/** | ||
* Generate a 12 byte id buffer used in ObjectId's | ||
@@ -167,3 +157,3 @@ * | ||
*/ | ||
generate(time) { | ||
static generate(time) { | ||
if ('number' !== typeof time) { | ||
@@ -173,3 +163,3 @@ time = ~~(Date.now() / 1000); | ||
const inc = this.get_inc(); | ||
const inc = ObjectId.getInc(); | ||
const buffer = Buffer.alloc(12); | ||
@@ -378,2 +368,23 @@ | ||
// Deprecated methods | ||
ObjectId.get_inc = deprecate( | ||
() => ObjectId.getInc(), | ||
'Please use the static `ObjectId.getInc()` instead' | ||
); | ||
ObjectId.prototype.get_inc = deprecate( | ||
() => ObjectId.getInc(), | ||
'Please use the static `ObjectId.getInc()` instead' | ||
); | ||
ObjectId.prototype.getInc = deprecate( | ||
() => ObjectId.getInc(), | ||
'Please use the static `ObjectId.getInc()` instead' | ||
); | ||
ObjectId.prototype.generate = deprecate( | ||
time => ObjectId.generate(time), | ||
'Please use the static `ObjectId.generate(time)` instead' | ||
); | ||
/** | ||
@@ -380,0 +391,0 @@ * @ignore |
@@ -254,8 +254,2 @@ 'use strict'; | ||
function serializeMinMax(buffer, key, value, index, isArray) { | ||
console.log({ | ||
value, | ||
MinKey, | ||
isMinKey: value instanceof MinKey | ||
}); | ||
// Write the type of either min or max key | ||
@@ -715,3 +709,3 @@ if (value === null) { | ||
index = serializeNull(buffer, key, value, index, true); | ||
} else if (value['_bsontype'] === 'ObjectId') { | ||
} else if (value['_bsontype'] === 'ObjectId' || value['_bsontype'] === 'ObjectID') { | ||
index = serializeObjectId(buffer, key, value, index, true); | ||
@@ -823,3 +817,3 @@ } else if (Buffer.isBuffer(value)) { | ||
index = serializeNull(buffer, key, value, index); | ||
} else if (value['_bsontype'] === 'ObjectId') { | ||
} else if (value['_bsontype'] === 'ObjectId' || value['_bsontype'] === 'ObjectID') { | ||
index = serializeObjectId(buffer, key, value, index); | ||
@@ -926,3 +920,3 @@ } else if (Buffer.isBuffer(value)) { | ||
index = serializeNull(buffer, key, value, index); | ||
} else if (value['_bsontype'] === 'ObjectId') { | ||
} else if (value['_bsontype'] === 'ObjectId' || value['_bsontype'] === 'ObjectID') { | ||
index = serializeObjectId(buffer, key, value, index); | ||
@@ -929,0 +923,0 @@ } else if (Buffer.isBuffer(value)) { |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -17,0 +17,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1204050
36
30338
5
10