This repository was archived by the owner on Mar 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Hello Search
adamfowleruk edited this page Jan 20, 2016
·
3 revisions
This tutorial will get you started with a Node.js application against a MarkLogic V6+ default install very quickly
- MarkLogic V6+ installed with admin account user/pass as admin/admin
- Node.js V0.8+ installed
Use NPM to install MLJS:-
npm install mljs
Create a file called hellosearch.js with the following content:-
var mljs = require("mljs");
var db = new mljs(); // default options
db.save({from: "test", to: "all", body: "wibble"},"/messages/1", {collection: "messages"},function(result) {
// now fetch it
db.get("/messages/1", function(result) {
// now print it
console.log("Doc content: " + JSON.stringify(result.doc));
// now delete it
db.delete("/messages/1", function(result) {
console.log("Doc deleted");
});
});
});
Now execute this with:-
node hellosearch.js
You should see the output produced.
For a comprehensive list of samples, visit the Node.js test scripts here: https://github.com/adamfowleruk/mljs/tree/master/test