@@ -18,30 +18,36 @@ Release 1.0.0 of the MarkLogic Node.js API
18
18
19
19
## Sample
20
20
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
+
21
27
The following example creates two documents in a collection using the built-in
22
28
REST server for the Documents database:
23
29
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
+ });
45
51
```
46
52
47
53
Other calls can create additional documents for the same collection.
0 commit comments