Batch data manipulation can be super handy for all sorts of operations. Good news is, DML (data manipulation language) in N1QL provides full support for, not just singleton operations, but for powerful bulk/batch data transformation. Here are a few powerful examples;

– UPDATE can help you add and initialize a new attribute in documents that do not have the last_updated attribute. .

Or break a name attribute into first and last name.


– INSERT statement can batch in a few ways. Here is a sample with VALUES.

I also frequently copy my bucket data to other buckets for expimentation using INSERT. INSERT with SELECT moves large sets of data around with a single statement. Here is how to create a copy of bucket_1 under a new name bucket_2.

I also use UPSERT to merge the changes from bucket_1 to bucket_2 as bucket_1 changes.


Batch updates and bulk operations can be challenging to code without flexibilities of SQL. N1QL lets you do all that and more with JSON!

You can find more details on DML statements here:







Happy testing.



Posted by Cihan Biyikoglu, Director of Product Management, Couchbase

Cihan Biyikoglu is a director of product management at Couchbase, responsible for the Couchbase Server product. Cihan is a big data enthusiast who brings over twenty years of experience to Redis Labs’ product team. Cihan started his career as a C/C++ developer.

Leave a reply