MCPcopy
hub / github.com/mongodb/node-mongodb-native / compareObjectId

Function compareObjectId

src/utils.ts:1119–1133  ·  src/utils.ts::compareObjectId
(oid1?: ObjectId | null, oid2?: ObjectId | null)

Source from the content-addressed store, hash-verified

1117 * - `+0 = oid1 is equal oid2`
1118 */
1119export function compareObjectId(oid1?: ObjectId | null, oid2?: ObjectId | null): 0 | 1 | -1 {
1120 if (oid1 == null && oid2 == null) {
1121 return 0;
1122 }
1123
1124 if (oid1 == null) {
1125 return -1;
1126 }
1127
1128 if (oid2 == null) {
1129 return 1;
1130 }
1131
1132 return ByteUtils.compare(oid1.id, oid2.id);
1133}
1134
1135export function parseInteger(value: unknown): number | null {
1136 if (typeof value === class="st">'number') return Math.trunc(value);

Callers 3

updateRsFromPrimaryFunction · 0.90
equalsMethod · 0.90
utils.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected