Cloudant Fundamentals: Using the Bulk API

Bulk up your CRUD (part 5 of 10)

Glynn Bird
Jun 4, 2018 · 3 min read
  • POST /db/_bulk_docs - for creates, updates and deletions
Bulk candy, bulk docs — you get the idea. Photo by Matt Schwartz on Unsplash

Creating documents in bulk

Let’s create a file called bulk.json that contains the documents we want to write:

Reading the documents back in bulk

As well as reading back single documents:

Updating documents in bulk

Let’s update our bulk.json file to prepare it for a bulk update. We need to:

  • add the data we want to add, in this case the IMDB URL of each actor

Bulk deletions

The process for bulk deletions is similar to bulk updates, except that we don’t need to supply a document body, only a _deleted: true flag for each _id/_rev pair:

Next time

In the next blog we’ll look at the programmatic equivalents of these Cloudant create/read/update/delete and bulk operations.

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.

Glynn Bird

Written by

Developer @ IBM. https://glynnbird.com

IBM CODAIT

Things we made with data at IBM’s Center for Open Source Data and AI Technologies.