bson 4.6.1 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bson.esm.js CHANGED
@@ -2562,7 +2562,7 @@ var ObjectId = /** @class */ (function () {
2562
2562
  this[kId] = Buffer.from(workingId, 'hex');
2563
2563
  }
2564
2564
  else {
2565
- throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters');
2565
+ throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer');
2566
2566
  }
2567
2567
  }
2568
2568
  else {
@@ -2679,7 +2679,7 @@ var ObjectId = /** @class */ (function () {
2679
2679
  return false;
2680
2680
  }
2681
2681
  if (otherId instanceof ObjectId) {
2682
- return this.toString() === otherId.toString();
2682
+ return this[kId][11] === otherId[kId][11] && this[kId].equals(otherId[kId]);
2683
2683
  }
2684
2684
  if (typeof otherId === 'string' &&
2685
2685
  ObjectId.isValid(otherId) &&
@@ -2696,7 +2696,9 @@ var ObjectId = /** @class */ (function () {
2696
2696
  if (typeof otherId === 'object' &&
2697
2697
  'toHexString' in otherId &&
2698
2698
  typeof otherId.toHexString === 'function') {
2699
- return otherId.toHexString() === this.toHexString();
2699
+ var otherIdString = otherId.toHexString();
2700
+ var thisIdString = this.toHexString().toLowerCase();
2701
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
2700
2702
  }
2701
2703
  return false;
2702
2704
  };