@tomsd/mongodbclient 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +16 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,11 +16,19 @@ const collectionname = "mycollection";
16
16
 
17
17
  const mdbc = new MClient(uri, dbname, collectionname);
18
18
 
19
- const items = [
20
- {name:"alice"},
21
- {name:"bob"},
22
- {name:"charlie"},
23
- {name:"alice"}
19
+ type Seed = {
20
+ name: string;
21
+ };
22
+
23
+ type Entry = Seed & {
24
+ _id: string;
25
+ };
26
+
27
+ const items: Seed[] = [
28
+ { name: "alice" },
29
+ { name: "bob" },
30
+ { name: "charlie" },
31
+ { name: "alice" }
24
32
  ];
25
33
 
26
34
  mdbc.insertMany(items)
@@ -31,12 +39,12 @@ mdbc.insertMany(items)
31
39
  .then((collections) => {
32
40
  console.log(
33
41
  collections.find(
34
- collection => collection.s.namespace.db === dbname
42
+ (collection: any) => collection.s.namespace.db === dbname
35
43
  )
36
44
  );
37
- return mdbc.read({});
45
+ return mdbc.read<Entry>();
38
46
  })
39
- .then((docs: any) => {
47
+ .then((docs) => {
40
48
  console.log({
41
49
  docs,
42
50
  state: docs.length >= 4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomsd/mongodbclient",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "",
5
5
  "main": "dist/cjs/mongodbclient.js",
6
6
  "module": "dist/esm/mongodbclient.js",