Server-Side JavaScript


What It Is

Server-Side JavaScript allows developers to access the powerful query and data manipulation capabilities of MarkLogic in a language and with tools that they’re already familiar with. Combined with JSON as a native data format, MarkLogic provides an ideal platform for building JSON-based services with JavaScript.

Why It Matters

JavaScript has emerged as the language of the web. The move toward advanced applications in the browser and multi-disciplinary DevOps have pushed JavaScript and JSON to the command line, onto devices, down into middleware (Node.js) and now into the database itself. JavaScript has familiar C-like syntax with flexible typing, advanced OOP, and functional programming capabilities.

Because JSON is JavaScript, JavaScript is ideally suited for building and consuming JSON-based services, whether public or behind the firewall. MarkLogic’s Server-Side JavaScript implementation gives developers a friendly API to express queries, aggregates, and data manipulation while automatically distributing evaluation across a cluster to run in parallel, close to the data.

MarkLogic also has JSearch, a higher-level API, that makes common functionality like full-text search, faceted navigation, and aggregates more easily accessible. For developers who are familiar with MarkLogic, the JSearch API is like the XQuery search API, except for JavaScript.

To make all of this run fast and be reliable, MarkLogic has embedded Google’s V8 engine—the same one that powers Chrome. V8 provides proven performance and stability as a front-end interface for the mature, high-performance C++ at MarkLogic’s core.

Benefits of Server-Side JavaScript:

  • Develop faster and easier on MarkLogic – Leverage intuitive APIs and familiar syntax that make working with MarkLogic familiar and comfortable.
  • Better integrate with existing skills and tools in your organization – Build a team with resources you already have, providing developers with an environment that will help them succeed.
  • Access MarkLogic’s proven capabilities – Gain access to MarkLogic through a pure JSON and JavaScript lens without having to compromise on performance, reliability, or security.
  • Better leverage your existing MarkLogic investment – Manage JSON, XML, and RDF data with JavaScript. Call existing XQuery library modules as if they were native JavaScript. Evaluate XPath (on both XML and JSON) from JavaScript. Issue SPARQL and SQL queries from JavaScript. Invoke and eval JavaScript from XQuery.