File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ collection into the Documents database using MarkLogic's built-in REST server
37
37
at port 8000:
38
38
39
39
``` javascript
40
- var marklogic = require (' marklogic' );
40
+ const marklogic = require (' marklogic' );
41
41
42
- var db = marklogic .createDatabaseClient ({
42
+ const db = marklogic .createDatabaseClient ({
43
43
host: ' localhost' ,
44
44
port: ' 8000' ,
45
45
database: ' Documents' ,
@@ -48,6 +48,17 @@ var db = marklogic.createDatabaseClient({
48
48
authType: ' DIGEST'
49
49
});
50
50
51
+ // For MarkLogic Cloud
52
+ const db = marklogic .createDatabaseClient ({
53
+ apiKey: ' changeme' ,
54
+ host: ' example.beta.marklogic.com' ,
55
+ authType: ' cloud' ,
56
+ // basePath is optional.
57
+ basePath: ' /marklogic/test' ,
58
+ // accessTokenDuration (in seconds) is optional and can be used to customize the expiration of the access token.
59
+ accessTokenDuration: 10
60
+ });
61
+
51
62
db .createCollection (
52
63
' /books' ,
53
64
{author: ' Beryl Markham' , ... },
Original file line number Diff line number Diff line change @@ -19,17 +19,18 @@ and writes a document in database - Documents */
19
19
20
20
const marklogic = require ( '../' ) ;
21
21
22
- let db = marklogic . createDatabaseClient ( {
22
+ const db = marklogic . createDatabaseClient ( {
23
23
// The below key-value pairs are required
24
- apiKey : 'apiKey ' ,
25
- host : 'example.marklogic.com' ,
24
+ apiKey : 'changeme ' ,
25
+ host : 'example.beta. marklogic.com' ,
26
26
authType : 'cloud' ,
27
- basePath : 'basePath' ,
28
- // accessTokenDuration is optional and can be used to customize the expiration of the access token.
27
+ // basePath is optional.
28
+ basePath : '/marklogic/test' ,
29
+ // accessTokenDuration (in seconds) is optional and can be used to customize the expiration of the access token.
29
30
accessTokenDuration : 10
30
31
} ) ;
31
32
32
- let writeObject = {
33
+ const writeObject = {
33
34
uri : '/write/string1.json' ,
34
35
contentType : 'application/json' ,
35
36
content : '{"key1":"value 1"}'
You can’t perform that action at this time.
0 commit comments