rawCollection().insertMany shows ID as object instead of objectID

I am trying to import data into my meteor app from another application.
I have written a script for that and sometimes generate objectIds using new Mongo.ObjectID()
When I write these documents to the database using rawCollection().insertMany, the objectIds are cast to the type object with the key _str, as in {_str: 'a8bf7416f49898b707cc0375'}
Is there a way to use rawCollection().insertMany that preserves the type ObjectId?

1 Like

I realized that instead of using
I can use the object id of the unterlying mongodb npm package. The ObjectID() if this package is available within Meteor like so:
Like this, the ObjectId is not cast to an object with the attribute _str during an updateMany function call.