-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.ts
More file actions
31 lines (28 loc) · 765 Bytes
/
example.ts
File metadata and controls
31 lines (28 loc) · 765 Bytes
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
import lib from "./lib"
import { MongoClient } from "mongodb"
const main = async () => {
const client = await MongoClient.connect(
"mongodb://localhost:27017/study", {
useNewUrlParser: true,
useUnifiedTopology: true
})
const db = client.db()
const collections = (await db.listCollections().toArray()).map((args) => {
return args.name
})
lib.createSchedule({
ms: 10000,
type: "json",
dbHost: "mongodb://localhost:27017/study",
dirName: "myDB",
path: "./",
workName: "myWork1"
}, ...collections)
setTimeout(() => {
console.log(lib.getSchedules())
}, 20000)
setTimeout(() => {
lib.deleteSchedule("myWork1")
}, 30000)
}
main()