11# MarkLogic Client API for Node.js
22
33The MarkLogic Client API for Node.js provides access to the MarkLogic database
4- from Node.js.
4+ from Node.js applications.
5+
6+ ## Features
7+
8+ * Writing, reading, patching, and deleting documents in JSON, XML, text, or binary formats
9+ * Querying over documents including parsing string queries, extracting properties, and calculating facets
10+ * Projecting tuples (like table rows) out of documents
11+ * Single transactions and multi-statement transactions for database changes
12+ * Writing, reading, and deleting graphs and executing SPARQL queries over graphs
13+ * Extending the built-in services or evaluating or invoking your own JavaScript or XQuery on the server
514
615## Status
716
8- This branch provides the work in progress for the Early Access Release 3 of the MarkLogic Node.js API.
17+ Release 1.0.0 of the MarkLogic Node.js API
918
10- ## Getting started
19+ ## Sample
1120
12- Please register at the MarkLogic Early Access website and then follow the tutorial instructions:
21+ The following example creates two documents in a collection using the built-in
22+ REST server for the Documents database:
1323
14- http://ea.marklogic.com/features/node-js-client-api/
24+ ```
25+ var marklogic = require('marklogic');
1526
16- The instructions describe:
27+ var db = marklogic.createDatabaseClient({
28+ host: 'localhost',
29+ port: '8000',
30+ user: 'admin',
31+ password: 'admin',
32+ authType: 'DIGEST'
33+ });
1734
18- * installing the MarkLogic database and setting up an admin user
19- * cloning this repository to set up the API
20- * working through some initial examples to get familiar with the API
35+ db.createCollection(
36+ '/books',
37+ {author: 'Beryl Markham', ...},
38+ {author: 'WG Sebald', ...}
39+ )
40+ .result(function(response) {
41+ console.log(JSON.stringify(response,null,2));
42+ }, function (error) {
43+ console.log(JSON.stringify(error,null,2));
44+ });
45+ ```
2146
22- For more detail about the API, use the documentation login from the Early Access to view
23- the reference documentation:
47+ Other calls can create additional documents for the same collection.
2448
25- http://docs-ea.marklogic.com/jsdoc/index.html
49+ ## Getting started
2650
27- After installing the dependencies including gulp, you can also build the documentation locally
28- from the root directory of the marklogic package:
51+ Here are some resources that walk you through working with MarkLogic using the Node.js API:
2952
30- gulp doc
53+ * http://developer.marklogic.com/features/node-api
54+ * http://docs.marklogic.com/guide/node-dev/intro#id_68052
3155
32- The documentation should be produced in the doc subdirectory.
56+ The instructions describe:
57+
58+ * installing the MarkLogic database and setting up an admin user
59+ * installing the Node.js API using npm
60+ * working through some initial examples to get familiar with the API
3361
3462### Example setup
3563
36- To set up the REST users for the examples, execute the following
37- command in the root directory for the marklogic package:
64+ The Node.js API also distributes with some additional examples to supplement
65+ the examples from the Getting Started introduction.
3866
39- node etc/users-setup.js
67+ Follow the instructions in the example distribution:
4068
41- Then, load the sample data:
69+ examples/1readme.txt
4270
43- node examples/before-load.js
71+ ### Documentation setup
4472
45- You can then execute any of the examples in the examples
46- subdirectory from the root directory for the marklogic package.
73+ After installing the dependencies including gulp, you can also build the reference
74+ documentation locally from the root directory of the marklogic package:
75+
76+ gulp doc
77+
78+ The documentation should be produced in the doc subdirectory.
4779
4880### Test setup and teardown
4981
@@ -56,63 +88,6 @@ To tear down the test database and REST server, execute
5688
5789 node etc/test-teardown.js
5890
59- ### Capabilities added to the Node.js Client API in Early Access 3
60-
61- * quick path for simple CRUD and query on the database client
62- * values and tuples requests
63- * server-side transforms on query response summary and result documents in slice() clause
64- * snippets including custom snippets in slice() clause
65- * extract from result documents (projection)
66- * resource service CRUD and invocation
67- * graph CRUD and SPARQL query
68- * bitemporal document CRUD and query
69- * specifying the database when creating a database client
70- * server-side eval and invoke
71- * search suggest
72-
73- ### Capabilities of the Node.js Client API in Early Access 2
74-
75- * createDatabaseClient() including HTTPS
76- * documents.query()
77- * queryBuilder.where() including structured query builder
78- * queryBuilder.byExample() for QBE (Query By Example)
79- * queryBuilder.parsedFrom() for string query
80- * queryBuilder.orderBy()
81- * queryBuilder.calculate()
82- * queryBuilder.slice()
83- * queryBuilder.withOptions()
84- * queryBuilder.parsedFrom()
85- * queryBuilder.copyFrom()
86- * documents.check()
87- * documents.remove()
88- * documents.read()
89- * documents.createReadStream()
90- * documents.write()
91- * documents.createWriteStream()
92- * documents.removeAll()
93- * documents.patch()
94- * transactions.open()
95- * transactions.read()
96- * transactions.commit()
97- * transactions.rollback()
98- * config.transforms.list()
99- * config.transforms.read()
100- * config.transforms.remove()
101- * config.transforms.write()
102- * config.properties.read()
103- * config.properties.write()
104- * config.extlibs.list()
105- * config.extlibs.read()
106- * config.extlibs.remove()
107- * config.extlibs.write()
108- * optimistic locking
109-
110- ### Limitations in Early Access 3
111-
112- The MarkLogic Node.js Client API has not yet undergone performance or
113- stress testing. The API should not be used in production in EA3. The
114- interface may change before the initial release.
115-
11691## Support
11792
11893The MarkLogic Node.js Client API is maintained by MarkLogic Engineering.
@@ -124,4 +99,5 @@ any request. In addition, MarkLogic provides technical support
12499for [ release tags] ( https://github.com/marklogic/node-client-api/releases )
125100of the Node Client API to licensed customers under the terms outlined
126101in the [ Support Handbook] ( http://www.marklogic.com/files/Mark_Logic_Support_Handbook.pdf ) .
127- For more information or to sign up for support, visit [ help.marklogic.com] ( help.marklogic.com ) .
102+ For more information or to sign up for support,
103+ visit [ help.marklogic.com] ( http://help.marklogic.com ) .
0 commit comments