-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd.js
42 lines (37 loc) · 826 Bytes
/
jd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const JardiDocs = require('./lib/JardiDocs.js');
class JardiSample {
constructor(cb) {
this.jd = new JardiDocs(process.env.JARDI_MONGO_URI);
this.jd.init()
.then(() => cb())
.catch((err) => cb(err));
}
list(cb) {
this.jd.listDocuments({})
.then((docs)=> {
console.log("docs:", docs);
cb(null, docs);
})
.catch((err) => {
console.error("list error:",err);
cb(err);
});
}
close() {
var jd = this.jd;
jd.close();
}
}
try {
var js = new JardiSample((err) => {
if (err) {
console.error("init error:", err);
return;
}
js.list(() => {
js.close();
});
});
} catch (exception) {
console.info("JardiSample Exception: ", exception);
}