Bulk write/operations in Realm Node JS SDK?

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.

RealmJS team, is bulkWrite indeed supported or have I missed something?

Hey Jean-Baptiste,

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.

Hey Nick,

Thanks for the clarification and for the workaround!

It would be cool to support this in the SDK, for server-side applications. I hope it’ll be added sometime in the future.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.