Skip to content

Commit

Permalink
fix(object-id): correct serialization of old ObjectID types
Browse files Browse the repository at this point in the history
fixes NODE-1769
  • Loading branch information
mbroadst committed Nov 27, 2018
1 parent 1a1fd72 commit 8d57a8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/parser/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ function serializeInto(
index = serializeNull(buffer, key, value, index, true);
} else 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);
} else if (Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index, true);
Expand Down Expand Up @@ -818,7 +818,7 @@ function serializeInto(
index = serializeDate(buffer, key, value, index);
} else if (value === null || (value === undefined && ignoreUndefined === false)) {
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);
} else if (Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
Expand Down Expand Up @@ -920,7 +920,7 @@ function serializeInto(
if (ignoreUndefined === false) index = serializeNull(buffer, key, value, index);
} else if (value === null) {
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);
} else if (Buffer.isBuffer(value)) {
index = serializeBuffer(buffer, key, value, index);
Expand Down

0 comments on commit 8d57a8c

Please sign in to comment.