You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
From my previous analysis it comes down to the fact that when the input is cast into a native oid, the underlying bson library first runs an isValid check. The argument is not a number or a string (typeof notNativeId === 'object') so it immediately checks the length. notNativeId has no length property so it fails validation (notNativeId.length === undefined where 12 or 24 was expected.)
The text was updated successfully, but these errors were encountered:
via @kurttheviking:
a contrived but simple example:
From my previous analysis it comes down to the fact that when the input is cast into a native oid, the underlying bson library first runs an isValid check. The argument is not a number or a string (
typeof notNativeId === 'object'
) so it immediately checks the length.notNativeId
has no length property so it fails validation (notNativeId.length === undefined
where12
or24
was expected.)The text was updated successfully, but these errors were encountered: