What is the recommended method for handling bulk inserts with the new SDK?

Hi,

I have a bunch of models queued and I would like to perform a bulk save. I can’t find the docs for what the current API is for the Node SDK. Hoping someone can point me to them, or give me an example.

For now, I’m manually looping however, I thought there was an API to handle this behavior. I’m a newbie to couchbase, so I could be wrong.

Thank you,
Amal

Hey @amalhussein,

The Node.js SDK does not provide a singular method which allows you to perform bulk operations except for a bulk get operation (getMulti). The reason for this is that each mutation operation which is available in Couchbase has its own unique set of parameters, and in many cases specifying 1 value for all items doesn’t make much sense (expiry, cas, etc…).

Instead of providing such an API, we have instead opted to optimize the client to be able to handle large quantities of operations being dispatched simultaneously, and have optimized this path substantially such that many of the same operation dispatched at once will be gathered and written to the network together.

Cheers, Brett

1 Like