JavaScript MarkLogic V6 driver ready for use

I’ve completed the first fully tested NodeJS JavaScript database driver. In this post I give a brief update and announce why it’s ready for testing, and what this means.

As you may already know, I created a JavaScript database driver, and have asked for feedback on candidate features for future versions. I’ve managed to use my spare time in and out of work in the last week to complete the creation of this driver for NodeJS. I’m working on a Situational Awareness demonstration that needed it, so I thought I’d share my work, and add a few likely needed features along the way.

What I’ve created is pretty special, even if I do say so myself. It’s a library for NodeJS with minimal dependencies that allows rapid creation of an application on a NodeJS server that interacts with a MarkLogic 6 database over the REST API. What’s particularly special is that this driver natively uses JSON. There’s no translation in the database driver. The MarkLogic server REST API handles JSON natively, so I as an application developer don’t have to think about the difference between this and XML documents at all.

I’ve tried to cover off all the basic features most people will want. Things like database creation, and destruction. Create, update, read and delete documents and their metadata. Add documents to collections. Fetch documents under a particular directory or within a collection.

I’ve also added some native MarkLogic Wizardry. ACID Transaction are supported by default in MarkLogic server, and I’ve built this driver to allow a transaction boundary across REST API requests. So you can add many documents in a single hit in a single transaction. Abandoning the transaction means the documents never appear in the database, so you have complete consistency. As an app developer all you need do is wrap your code in a beginTransaction function, and call commit or rollbackTransaction within the code. Easy!

I’ve also rolled in a few MarkLogic search features. Basic key-value is of course there. As is support for the default search grammar. E.g. for a doc with “Squirrels are fast” anywhere in it’s content, you can do the query “squirrel NEAR fast” to find that document. Word stemming is built in to MarkLogic server, as are NEAR queries and a range of other Search features – all without any separate search engine integration work on your part!

I’ve even included support for structured search. This means you can pass in a very long, sophisticated search configuration much like you do using cts:word-query, cts:and-query, etc. The driver will execute this on the fly on the MarkLogic server. Of course you need to ensure the indexes are there, but if they are you’ll be able to perform any search supported by MarkLogic server!

I’ve completed running a full set of test suites. Below are instructions on getting and playing with the driver. Also please add issues for future features, or problems you encounter. I’m taking suggestions for new features now, so feed back ASAP!

Links

Advertisements

2 comments

  1. This looks great. I’ve been looking for a backend for my node.js side project and this might work. I used json from marklogic 6 on node.js project before but i just wrote my own web service. I’ll have to check this out more.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s