ObjectIdUtils

mongodb. ObjectIdUtils

Utility functions for dealing with MongoDB ObjectIds

Constructor

new ObjectIdUtils()

Source:

Methods

(async, static) addSchemaKeyword()

Source:
Registers the isObjectId JSON schema keyword

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

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

(static) isValid(s) → {Boolean}

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

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

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

(static) parseIds(o)

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