Try this:
objectId.str
See the doc.
ObjectId()
has the following attribute and methods:[…]
str
– Returns the hexadecimal string representation of the object.
More Related Contents:
- Aggregation filter after $lookup
- Convert date from milliseconds to ISODate object
- Group by Date with Local Time Zone in MongoDB
- How to properly reuse connection to Mongodb across NodeJs application and modules
- Render basic HTML view?
- How do I query referenced objects in MongoDB?
- Mongoose auto increment
- How do I remove documents using Node.js Mongoose?
- How do you put an image file in a json object?
- Mongoose difference between .save() and using update()
- How can I promisify the MongoDB native Javascript driver using bluebird?
- When to close MongoDB database connection in Nodejs
- How to exclude some fields from the document
- Mongoose subdocuments vs nested schema
- Formatting ISODate from Mongodb
- How to get updated document back from the findOneAndUpdate method?
- Why is an _id with ObjectID added to when using MongoDB’s $push to add new object to an array?
- Can I determine if a string is a MongoDB ObjectID?
- What is a TransientTransactionError in Mongoose (or MongoDB)?
- Mongoose.js: Find user by username LIKE value
- How to use MongoDB with promises in Node.js?
- Create an ISO date object in javascript
- Getting timestamp from mongodb id
- Node.js mongodb driver async/await queries
- Storing data stream from POST request in GridFS, express, mongoDB, node.js
- How to convert a string to ObjectId in nodejs mongodb native driver?
- Loop through all Mongo collections and execute query
- JavaScript NoSQL Injection prevention in MongoDB
- Meteor publish/subscribe strategies for unique client-side collections
- MongooseError: Model.findOne() no longer accepts a callback at Function