Casts a string to (or create) an ObjectId.

In order to use custom id, castIds needs to be explicitly set to false as an option in collection operations.


  1. [string] (string): optional hex id to cast to ObjectId. If not provided, a random ObjectId will be created.


An ObjectId.


const monk = require('monk')
const id ='4ee0fd75d6bd52107c000118')
const newId =

results matching ""

    No results matching ""