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!
- Do a ‘npm install mldb’ to get the latest built (0.1.9)
- Visit the API documentation for descriptions of all the functions, and samples. Or the Wiki main page
- See the test status on GitHub
- Please add issues and feedback to the GitHub project, and request new features.
- Also, I should be at MarkLogic World 2013 in Las Vegas, so feel free to come chat to me about this project