How can I generate a new ObjectId

How can I generate a Mongo ID, the ObjectId function does not work
image

Hey @Mary_Jimenz!

MongoDB should automatically generate an Object ID for a new document (docs). If you omit the _id field do you see it get populated? Or are you looking for a different functionality?

yes, I know, but in this case I need to generate it manually

Ah sorry about that! Retool only supports MongoDB's Extended JSON Syntax so you might be able to create a 24-character hex string and then pass it with something like:

{ _id: { $oid: "[id_string]" } }

Curious to know more about your use case!