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.
@@ -4599,7 +4599,7 @@
4599
4599
  this[kId] = buffer_1.from(workingId, 'hex');
4600
4600
  }
4601
4601
  else {
4602
- throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters');
4602
+ throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer');
4603
4603
  }
4604
4604
  }
4605
4605
  else {
@@ -4716,7 +4716,7 @@
4716
4716
  return false;
4717
4717
  }
4718
4718
  if (otherId instanceof ObjectId) {
4719
- return this.toString() === otherId.toString();
4719
+ return this[kId][11] === otherId[kId][11] && this[kId].equals(otherId[kId]);
4720
4720
  }
4721
4721
  if (typeof otherId === 'string' &&
4722
4722
  ObjectId.isValid(otherId) &&
@@ -4733,7 +4733,9 @@
4733
4733
  if (typeof otherId === 'object' &&
4734
4734
  'toHexString' in otherId &&
4735
4735
  typeof otherId.toHexString === 'function') {
4736
- return otherId.toHexString() === this.toHexString();
4736
+ var otherIdString = otherId.toHexString();
4737
+ var thisIdString = this.toHexString().toLowerCase();
4738
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
4737
4739
  }
4738
4740
  return false;
4739
4741
  };