ObjectIdUtils

mongodb. ObjectIdUtils

Utility functions for dealing with MongoDB ObjectIds

Constructor

new ObjectIdUtils()

Source:

Methods

(async, static) addSchemaKeyword()

Description:
  • Registers the isObjectId JSON schema keyword
Source:

(static) create() → {external:MongoDBObjectId}

Description:
  • Creates a new ObjectId instance
Source:
Returns:
Type
external:MongoDBObjectId

(static) isValid(s) → {Boolean}

Description:
  • Checks a string is a valid ObjectId
Source:
Parameters:
Name Type Description
s String String to check
Returns:
Type
Boolean

(static) parse(s) → {external:MongoDBObjectId}

Description:
  • Converts a string to an ObjectId
Source:
Parameters:
Name Type Description
s String The string to convert
Throws:
Error
Returns:
The converted ID
Type
external:MongoDBObjectId

(static) parseIds(o)

Description:
  • Checks an input object for any strings which pass the parse check and convert matches to ObjectId instances
Source:
Parameters:
Name Type Description
o Object Object to be checked