I’m trying to perform bulk operations in the Realm Node JS SDK (10.6.1), but it seems all the functions are gone.
When trying collection.bulkWrite(...) or collection.initializeOrderedBulkOp(), I get a type errors:
TypeError: collection.bulkWrite is not a function TypeError: collection.initializeOrderedBulkOp is not a function.
Looking at the collection class, it seems indeed that those function do not exist:
But then how do you perform bulk operations?
It’s worth noting that the documentation about this is a mess, as this page explains how to use the bulkWrite method, and this one states that the bulkWrite method is not supported by MongoDB Realm.
The Realm SDKs do not support the MongoDB Bulk Write API. Those docs pages you linked are specifically for server-side functions, not the SDKs. For now, if you need to do bulk writes you can write that logic in a function and then call that function from the SDK.
Sorry about the confusion from the conflicting docs - we’re aware of it and should have a fix out sometime next week.