How can i do insertMany with custom _id field?

Hello everyone, I’m new to mongodb as well as the community, I was looking to replace the mongodb _id with a custom one when i do an insert or insertMany.
One way i can think of is looping through each element in the array and add _id field with the id i want, just wanted to know if this approach is right or is there a cleaner and better way to achieve this ?
Thanks

I don’t see any other way. If you want to assign a custom _id to an array of documents, the you have to loop over the documents and assign your custom _id.

Thanks steeve, will try this.