MarkLogic Node.js Client API

MarkLogic is a document database built from the ground up for managing heterogenous data. It stores and indexes JSON (and XML) natively and combines a complete JavaScript stored procedure environment and HTTP server, making it ideal for modern, full-stack JavaScript applications.

MarkLogic is used today in production on hundreds of mission-critical applications across different industries and the public sector. It provides the flexibility and scalability of NoSQL, without having to compromise on reliability and consistency that organizations have come to depend on with relational databases. Unlike most other NoSQL databases, MarkLogic offers ACID transactions—multi-document, multi-statement, and even XA—along with a rich set of built-in indexes, granular role-based security, and a shared-nothing architecture for scalability and high availability.

The MarkLogic Node.js Client API is the easiest way to integrate MarkLogic into a Node.js application. Installed from npm, it gives developers a fully asynchronous JavaScript API for document management, query, aggregates, and extensibility with JavaScript that runs in the database, close to the data.

Node.js Client API on GitHub ›

var marklogic = require('marklogic');
var conn = require('./env.js').connection; // Host and auth details
var db = marklogic.createDatabaseClient(conn);
var q = marklogic.queryBuilder;
db.documents.query(
  q.where(
    q.collection('countries'),
    q.value('region', 'Africa'),
    q.or(
      q.word('background', 'France'),
      q.word('Legal system', 'French')
    )
  )
).result(function(documents) {
    documents.forEach(function(document) {
      console.log(JSON.stringify(document));
    });
  });

Focus on application features rather than plumbing with out-of-the-box features

Move faster to production with proven reliability at scale

Maximize performance and flexibility—bringing code to the data

Enable modern end-to-end JavaScript development

Always open source on GitHub

Quick Start

Next Steps

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.