ArangoDB 3.12 Product Release Announcement! Read the blog for details. Read Blog

Vector-5

Bulk Document Lookups

Estimated reading time: 1 minutes

ArangoDB 2.6 comes with a specialized API for bulk document lookups. The new API allows fetching multiple documents from the server using a single request, making bulk document retrieval more efficient than when using one request per document to fetch.

Provided the documents keys are known, all the client application needs to do is to call the collection’s lookupByKeys method:

// list of document keys
var keys = [ "foo", "bar", "baz", ...];
var results = db.test.lookupByKeys(keys);
// now all documents are contained in variable 'results'

Additionally, the server-side REST API method for bulk document lookups can be invoked directly via HTTP as follows:

curl                                                  \
  -X PUT                                              \
  http://127.0.0.1:8529/_api/simple/lookup-by-keys    \
  --data '{"collection":"test","keys":["foo","bar","baz"]}'

Jan compared the functionality with single document requests in his latest blog post.

Picture of Ingo Friepoertner
May 08, 2015 ,

Ingo is dealing with all the good ideas from the ArangoDB community, customers and industry experts to improve the value provided by the company’s native multi-model approach. In former positions he worked as a product owner and tech consultant, building custom software solutions for large companies in various industries. Ingo holds a diploma in business informatics from FHDW University of Applied Sciences.

Leave a Comment