@@ -18,30 +18,36 @@ Release 1.0.0 of the MarkLogic Node.js API
1818
1919## Sample
2020
21+ First, install the MarkLogic into your local modules using [ npm] ( https://www.npmjs.com/package/marklogic ) .
22+
23+ ```
24+ npm install marklogic --save
25+ ```
26+
2127The following example creates two documents in a collection using the built-in
2228REST server for the Documents database:
2329
24- ```
25- var marklogic = require('marklogic');
26-
27- var db = marklogic.createDatabaseClient({
28- host: 'localhost',
29- port: '8000',
30- user: 'admin',
31- password: 'admin',
32- authType: 'DIGEST'
33- });
34-
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- });
30+ ``` javascript
31+ var marklogic = require (' marklogic' );
32+
33+ var db = marklogic .createDatabaseClient ({
34+ host: ' localhost' ,
35+ port: ' 8000' ,
36+ user: ' admin' ,
37+ password: ' admin' ,
38+ authType: ' DIGEST'
39+ });
40+
41+ db .createCollection (
42+ ' /books' ,
43+ {author: ' Beryl Markham' , ... },
44+ {author: ' WG Sebald' , ... }
45+ )
46+ .result (function (response ) {
47+ console .log (JSON .stringify (response,null ,2 ));
48+ }, function (error ) {
49+ console .log (JSON .stringify (error,null ,2 ));
50+ });
4551```
4652
4753Other calls can create additional documents for the same collection.
0 commit comments