@storecraft/database-mongodb 1.0.12 → 1.0.14

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.
package/src/con.posts.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @import { db_posts as db_col } from '@storecraft/core/database'
3
+ * @import { WithRelations } from './utils.relations.js'
4
+ */
5
+
1
6
  import { Collection } from 'mongodb'
2
7
  import { MongoDB } from '../index.js'
3
8
  import { count_regular, get_regular, list_regular } from './con.shared.js'
@@ -18,7 +23,7 @@ import {
18
23
  * @param {MongoDB} d
19
24
  *
20
25
  *
21
- * @returns {Collection<import('./utils.relations.js').WithRelations<db_col["$type_get"]>>}
26
+ * @returns {Collection<WithRelations<db_col["$type_get"]>>}
22
27
  */
23
28
  const col = (d) => d.collection('posts');
24
29
 
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @import { db_products as db_col, RegularGetOptions } from '@storecraft/core/database'
3
+ * @import { ProductType, VariantType } from '@storecraft/core/api'
4
+ * @import { WithRelations } from './utils.relations.js'
5
+ * @import { Filter, AnyBulkWriteOperation } from 'mongodb'
6
+ */
7
+
1
8
  import { Collection } from 'mongodb'
2
9
  import { MongoDB } from '../index.js'
3
10
  import {
@@ -25,18 +32,11 @@ import {
25
32
  test_product_filters_against_product
26
33
  } from '@storecraft/core/api/con.pricing.logic.js'
27
34
 
28
- /**
29
- * @typedef {import('@storecraft/core/database').db_products} db_col
30
- */
31
-
32
35
  /**
33
36
  * @param {MongoDB} d
34
37
  *
35
38
  *
36
- * @returns {Collection<
37
- * import('./utils.relations.js').WithRelations<db_col["$type_get"]>
38
- * >}
39
- *
39
+ * @returns {Collection<WithRelations<db_col["$type_get"]>>}
40
40
  */
41
41
  const col = (d) => d.collection('products');
42
42
 
@@ -304,7 +304,7 @@ const count = (driver) => count_regular(driver, col(driver));
304
304
  */
305
305
  const list_product_collections = (driver) => {
306
306
  return async (product) => {
307
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
307
+ /** @type {RegularGetOptions} */
308
308
  const options = {
309
309
  expand: ['collections']
310
310
  };
@@ -329,7 +329,7 @@ const list_product_collections = (driver) => {
329
329
  */
330
330
  const list_product_variants = (driver) => {
331
331
  return async (product) => {
332
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
332
+ /** @type {RegularGetOptions} */
333
333
  const options = {
334
334
  expand: ['variants']
335
335
  };
@@ -380,7 +380,7 @@ const list_related_products = (driver) => {
380
380
  */
381
381
  const list_product_discounts = (driver) => {
382
382
  return async (product) => {
383
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
383
+ /** @type {RegularGetOptions} */
384
384
  const options = {
385
385
  expand: ['discounts']
386
386
  };
@@ -462,12 +462,7 @@ const changeStockOfBy = (driver) => {
462
462
  return async (product_ids_or_handles, deltas) => {
463
463
 
464
464
  /**
465
- * @type {import('mongodb').AnyBulkWriteOperation<
466
- * import('./utils.relations.js').WithRelations<
467
- * import('@storecraft/core/api').ProductType |
468
- * import('@storecraft/core/api').VariantType
469
- * >
470
- * >[]}
465
+ * @type {AnyBulkWriteOperation<WithRelations<ProductType | VariantType>>[]}
471
466
  */
472
467
  let ops = []
473
468
 
package/src/con.search.js CHANGED
@@ -1,14 +1,14 @@
1
- import { MongoDB } from '../index.js'
2
- import { query_to_mongo } from './utils.query.js';
3
-
4
1
  /**
5
- * @typedef {import('@storecraft/core/database').search} db_col
2
+ * @import { search as db_col, db_driver } from '@storecraft/core/database'
3
+ * @import { QuickSearchResource, QuickSearchResult } from '@storecraft/core/api'
6
4
  */
7
5
 
6
+ import { MongoDB } from '../index.js'
7
+ import { query_to_mongo } from './utils.query.js';
8
8
 
9
9
 
10
10
  /**
11
- * @type {(keyof import('@storecraft/core/database').db_driver["resources"])[]}
11
+ * @type {(keyof db_driver["resources"])[]}
12
12
  */
13
13
  const tables = [
14
14
  'tags',
@@ -26,7 +26,7 @@ const tables = [
26
26
  ]
27
27
 
28
28
  /**
29
- * @type {Record<string, keyof import('@storecraft/core/database').db_driver["resources"]>}
29
+ * @type {Record<string, keyof db_driver["resources"]>}
30
30
  */
31
31
  const prefix_to_resource = {
32
32
  'au': 'auth_users',
@@ -49,7 +49,7 @@ const prefix_to_resource = {
49
49
  *
50
50
  * @param {string} id
51
51
  *
52
- * @returns {keyof import('@storecraft/core/database').db_driver["resources"]}
52
+ * @returns {keyof db_driver["resources"]}
53
53
  */
54
54
  export const id_to_resource = id => {
55
55
  let result = undefined;
@@ -102,28 +102,29 @@ export const quicksearch = (driver) => {
102
102
 
103
103
  const db = driver.mongo_client.db(driver.name);
104
104
 
105
- /** @type {import('@storecraft/core/api').QuickSearchResource[]} */
106
- const items = await db.collection(tables_filtered[0]).aggregate(
107
- [
108
- ...pipeline,
109
- ...tables_filtered.slice(1).map(
110
- t => (
111
- {
112
- $unionWith: {
113
- coll: t,
114
- pipeline: pipeline
105
+
106
+ const items = /** @type {QuickSearchResource[]} */ (
107
+ await db.collection(tables_filtered[0]).aggregate(
108
+ [
109
+ ...pipeline,
110
+ ...tables_filtered.slice(1).map(
111
+ t => (
112
+ {
113
+ $unionWith: {
114
+ coll: t,
115
+ pipeline: pipeline
116
+ }
115
117
  }
116
- }
118
+ )
117
119
  )
118
- )
119
- ],
120
- {
121
-
122
- }
123
- ).toArray();
120
+ ],
121
+ {
122
+ }
123
+ ).toArray()
124
+ );
124
125
 
125
126
 
126
- /** @type {import('@storecraft/core/api').QuickSearchResult} */
127
+ /** @type {QuickSearchResult} */
127
128
  const result = {};
128
129
 
129
130
  items.reduce(
package/src/con.shared.js CHANGED
@@ -1,3 +1,11 @@
1
+ /**
2
+ * @import { db_crud, RegularGetOptions } from '@storecraft/core/database'
3
+ * @import { ApiQuery, BaseType, Cursor, ExpandQuery, QuickSearchResource, QuickSearchResult, Tuple, withOptionalID } from '@storecraft/core/api'
4
+ * @import { VQL } from '@storecraft/core/vql'
5
+ * @import { WithRelations } from './utils.relations.js'
6
+ * @import { WithId } from 'mongodb'
7
+ */
8
+
1
9
  import { Collection } from 'mongodb'
2
10
  import { MongoDB } from '../index.js'
3
11
  import { handle_or_id, isUndef, sanitize_array,
@@ -8,18 +16,16 @@ import { add_search_terms_relation_on } from './utils.relations.js'
8
16
 
9
17
 
10
18
  /**
11
- * @template {import('@storecraft/core/api').BaseType} T
12
- * @template {import('@storecraft/core/api').BaseType} G
13
- *
19
+ * @template {BaseType} T
20
+ * @template {BaseType} G
14
21
  *
15
22
  * @param {MongoDB} driver
16
23
  * @param {Collection<G>} col
17
24
  *
18
- *
19
- * @returns {import('@storecraft/core/database').db_crud<T, G>["upsert"]}
20
- *
25
+ * @returns {db_crud<T, G>["upsert"]}
21
26
  */
22
27
  export const upsert_regular = (driver, col) => {
28
+
23
29
  return async (data, search_terms=[]) => {
24
30
 
25
31
  data = {...data};
@@ -82,13 +88,10 @@ export const get_relations_names = item => {
82
88
  /**
83
89
  * Expand relations in-place
84
90
  *
85
- *
86
91
  * @template {any} T
87
92
  *
88
- *
89
- * @param {import('./utils.relations.js').WithRelations<T>[]} items
90
- * @param {import('@storecraft/core/api').ExpandQuery} [expand_query]
91
- *
93
+ * @param {WithRelations<T>[]} items
94
+ * @param {ExpandQuery<T>} [expand_query]
92
95
  */
93
96
  export const expand = (items, expand_query=undefined) => {
94
97
 
@@ -100,9 +103,9 @@ export const expand = (items, expand_query=undefined) => {
100
103
  const all = expand_query.includes('*');
101
104
 
102
105
  for(const item of items) {
103
- expand_query = all ? get_relations_names(item) : expand_query;
106
+ const what_to_expand = all ? get_relations_names(item) : expand_query;
104
107
 
105
- for(const e of (expand_query ?? [])) {
108
+ for(const e of (what_to_expand ?? [])) {
106
109
  // try to find embedded documents relations
107
110
  const rel = item?._relations?.[e];
108
111
  if(rel===undefined || rel===null)
@@ -141,8 +144,8 @@ export const zeroed_relations = {
141
144
 
142
145
 
143
146
  /**
144
- *
145
- * @param {import('@storecraft/core/database').RegularGetOptions["expand"]} expand
147
+ * @template T
148
+ * @param {ExpandQuery<T>} expand
146
149
  */
147
150
  export const expand_to_mongo_projection = (expand) => {
148
151
  let projection = {}
@@ -163,18 +166,16 @@ export const expand_to_mongo_projection = (expand) => {
163
166
  /**
164
167
  * @template T, G
165
168
  *
166
- *
167
169
  * @param {MongoDB} driver
168
170
  * @param {Collection<G>} col
169
171
  *
170
- *
171
- * @returns {import('@storecraft/core/database').db_crud<T, G>["get"]}
172
+ * @returns {db_crud<T, G>["get"]}
172
173
  */
173
174
  export const get_regular = (driver, col) => {
174
175
  return async (id_or_handle, options) => {
175
176
  const filter = handle_or_id(id_or_handle);
176
177
 
177
- /** @type {import('./utils.relations.js').WithRelations<import('mongodb').WithId<G>>} */
178
+ /** @type {WithRelations<WithId<G>>} */
178
179
  const res = await col.findOne(
179
180
  filter,
180
181
  {
@@ -194,15 +195,15 @@ export const get_regular = (driver, col) => {
194
195
  * should be instead
195
196
  *
196
197
  *
197
- * @template {import('@storecraft/core/api').idable} T
198
- * @template {import('@storecraft/core/api').idable} G
198
+ * @template {withOptionalID} T
199
+ * @template {withOptionalID} G
199
200
  *
200
201
  *
201
202
  * @param {MongoDB} driver
202
203
  * @param {Collection<G>} col
203
204
  *
204
205
  *
205
- * @returns {import('@storecraft/core/database').db_crud<T, G>["getBulk"]}
206
+ * @returns {db_crud<T, G>["getBulk"]}
206
207
  */
207
208
  export const get_bulk = (driver, col) => {
208
209
  return async (ids, options) => {
@@ -247,7 +248,7 @@ export const get_bulk = (driver, col) => {
247
248
  * @param {Collection<G>} col
248
249
  *
249
250
  *
250
- * @returns {import('@storecraft/core/database').db_crud<T, G>["remove"]}
251
+ * @returns {db_crud<T, G>["remove"]}
251
252
  */
252
253
  export const remove_regular = (driver, col) => {
253
254
  return async (id_or_handle) => {
@@ -261,15 +262,15 @@ export const remove_regular = (driver, col) => {
261
262
  }
262
263
 
263
264
  /**
264
- * @template {any} T
265
- * @template {any} G
265
+ * @template T
266
+ * @template G
266
267
  *
267
268
  *
268
269
  * @param {MongoDB} driver
269
270
  * @param {Collection<G>} col
270
271
  *
271
272
  *
272
- * @returns {import('@storecraft/core/database').db_crud<T, G>["list"]}
273
+ * @returns {db_crud<T, G>["list"]}
273
274
  */
274
275
  export const list_regular = (driver, col) => {
275
276
  return async (query) => {
@@ -282,7 +283,7 @@ export const list_regular = (driver, col) => {
282
283
  // console.log('sort', sort)
283
284
  // console.log('expand', query?.expand)
284
285
 
285
- /** @type {import('mongodb').WithId<G>[]} */
286
+ /** @type {WithRelations<WithId<G>>[]} */
286
287
  const items = await col.find(
287
288
  filter, {
288
289
  sort,
@@ -295,7 +296,7 @@ export const list_regular = (driver, col) => {
295
296
 
296
297
  // try expand relations, that were asked
297
298
  const items_expended = expand(items, query?.expand);
298
-
299
+
299
300
  const sanitized = sanitize_array(items_expended);
300
301
 
301
302
  // console.log('sanitized', sanitized)
@@ -313,7 +314,7 @@ export const list_regular = (driver, col) => {
313
314
  * @param {Collection<G>} col
314
315
  *
315
316
  *
316
- * @returns {import('@storecraft/core/database').db_crud<T, G>["count"]}
317
+ * @returns {db_crud<T, G>["count"]}
317
318
  */
318
319
  export const count_regular = (driver, col) => {
319
320
  return async (query) => {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @import { db_shipping as db_col } from '@storecraft/core/database'
3
+ * @import { WithRelations } from './utils.relations.js'
4
+ */
5
+
1
6
  import { Collection } from 'mongodb'
2
7
  import { MongoDB } from '../index.js'
3
8
  import { count_regular, get_regular, list_regular } from './con.shared.js'
@@ -9,15 +14,11 @@ import {
9
14
  update_entry_on_all_connection_of_relation
10
15
  } from './utils.relations.js';
11
16
 
12
- /**
13
- * @typedef {import('@storecraft/core/database').db_shipping} db_col
14
- */
15
-
16
17
  /**
17
18
  * @param {MongoDB} d
18
19
  *
19
20
  *
20
- * @returns {Collection<import('./utils.relations.js').WithRelations<db_col["$type_get"]>>}
21
+ * @returns {Collection<WithRelations<db_col["$type_get"]>>}
21
22
  */
22
23
  const col = (d) => d.collection('shipping_methods');
23
24
 
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @import {
3
+ * db_storefronts as db_col, RegularGetOptions
4
+ * } from '@storecraft/core/database'
5
+ * @import { WithRelations } from './utils.relations.js'
6
+ */
7
+
1
8
  import { Collection } from 'mongodb'
2
9
  import { MongoDB } from '../index.js'
3
10
  import { count_regular, get_regular, list_regular,
@@ -8,18 +15,10 @@ import {
8
15
  } from './utils.relations.js';
9
16
  import { report_document_media } from './con.images.js';
10
17
 
11
- /**
12
- * @typedef {import('@storecraft/core/database').db_storefronts} db_col
13
- */
14
-
15
18
  /**
16
19
  * @param {MongoDB} d
17
20
  *
18
- *
19
- * @returns {Collection<
20
- * import('./utils.relations.js').WithRelations<db_col["$type_get"]>>
21
- * }
22
- *
21
+ * @returns {Collection<WithRelations<db_col["$type_get"]>>}
23
22
  */
24
23
  const col = (d) => d.collection('storefronts');
25
24
 
@@ -113,7 +112,7 @@ const count = (driver) => count_regular(driver, col(driver));
113
112
  */
114
113
  const list_storefront_products = (driver) => {
115
114
  return async (product) => {
116
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
115
+ /** @type {RegularGetOptions} */
117
116
  const options = {
118
117
  expand: ['products']
119
118
  };
@@ -132,7 +131,7 @@ const list_storefront_products = (driver) => {
132
131
  */
133
132
  const list_storefront_collections = (driver) => {
134
133
  return async (product) => {
135
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
134
+ /** @type {RegularGetOptions} */
136
135
  const options = {
137
136
  expand: ['collections']
138
137
  };
@@ -151,7 +150,7 @@ const list_storefront_collections = (driver) => {
151
150
  */
152
151
  const list_storefront_discounts = (driver) => {
153
152
  return async (product) => {
154
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
153
+ /** @type {RegularGetOptions} */
155
154
  const options = {
156
155
  expand: ['discounts']
157
156
  };
@@ -169,7 +168,7 @@ const list_storefront_discounts = (driver) => {
169
168
  */
170
169
  const list_storefront_shipping_methods = (driver) => {
171
170
  return async (product) => {
172
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
171
+ /** @type {RegularGetOptions} */
173
172
  const options = {
174
173
  expand: ['shipping_methods']
175
174
  };
@@ -188,7 +187,7 @@ const list_storefront_shipping_methods = (driver) => {
188
187
  */
189
188
  const list_storefront_posts = (driver) => {
190
189
  return async (product) => {
191
- /** @type {import('@storecraft/core/database').RegularGetOptions} */
190
+ /** @type {RegularGetOptions} */
192
191
  const options = {
193
192
  expand: ['posts']
194
193
  };
package/src/con.tags.js CHANGED
@@ -1,13 +1,12 @@
1
+ /**
2
+ * @import { db_tags as db_col } from '@storecraft/core/database'
3
+ */
4
+
1
5
  import { Collection } from 'mongodb'
2
6
  import { MongoDB } from '../index.js'
3
7
  import { count_regular, get_regular, list_regular,
4
8
  remove_regular, upsert_regular } from './con.shared.js'
5
9
 
6
- /**
7
- * @typedef {import('@storecraft/core/database').db_tags} db_col
8
- */
9
-
10
-
11
10
  /**
12
11
  * @param {MongoDB} d
13
12
  *
@@ -1,13 +1,12 @@
1
+ /**
2
+ * @import { db_templates as db_col } from '@storecraft/core/database'
3
+ */
4
+
1
5
  import { Collection } from 'mongodb'
2
6
  import { MongoDB } from '../index.js'
3
7
  import { count_regular, get_regular, list_regular,
4
8
  remove_regular, upsert_regular } from './con.shared.js'
5
9
 
6
- /**
7
- * @typedef {import('@storecraft/core/database').db_templates} db_col
8
- */
9
-
10
-
11
10
  /**
12
11
  * @param {MongoDB} d
13
12
  *
@@ -140,10 +140,12 @@ export const handle_or_id = (handle_or_id) => {
140
140
  */
141
141
  export const objid_or_else_filter = (id_or_else, else_key='handle') => {
142
142
  try {
143
+ // @ts-ignore
143
144
  return {
144
145
  _id: to_objid(id_or_else)
145
146
  }
146
147
  } catch (e) {
148
+ // @ts-ignore
147
149
  return {
148
150
  [else_key]: id_or_else
149
151
  }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @import { ApiQuery, Cursor, Tuple } from '@storecraft/core/api'
3
+ * @import { VQL } from '@storecraft/core/vql'
4
+ */
5
+
1
6
  import { to_objid } from "./utils.funcs.js";
2
7
  import { parse } from "@storecraft/core/vql";
3
8
 
@@ -17,7 +22,7 @@ let a = {
17
22
  * 4. (a1, a2, a3) >= (b1, b2, b3) ==> (a1 > b1) || (a1=b1 & a2>b2) || (a1=b1 & a2=b2 & a3>=b3)
18
23
  *
19
24
  *
20
- * @param {import("@storecraft/core/api").Cursor} c
25
+ * @param {Cursor} c
21
26
  * @param {'>' | '>=' | '<' | '<='} relation
22
27
  * @param {(x: [k: string, v: any]) => [k: string, v: any]} transformer
23
28
  * Your chance to change key and value
@@ -70,7 +75,7 @@ export const query_cursor_to_mongo = (c, relation, transformer=(x)=>x) => {
70
75
  }
71
76
 
72
77
  /**
73
- * @param {import("@storecraft/core/vql").VQL.Node} node
78
+ * @param {VQL.Node} node
74
79
  */
75
80
  export const query_vql_node_to_mongo = node => {
76
81
  if(node.op==='LEAF') {
@@ -106,7 +111,7 @@ export const query_vql_node_to_mongo = node => {
106
111
 
107
112
  /**
108
113
  *
109
- * @param {import("@storecraft/core/vql").VQL.Node} root
114
+ * @param {VQL.Node} root
110
115
  */
111
116
  export const query_vql_to_mongo = root => {
112
117
  return root ? query_vql_node_to_mongo(root) : undefined;
@@ -115,23 +120,21 @@ export const query_vql_to_mongo = root => {
115
120
  /**
116
121
  * Let's transform ids into mongo ids
117
122
  *
118
- *
119
- * @param {import("@storecraft/core/api").Tuple<string>} c a cursor record
120
- *
123
+ * @param {Tuple} c a cursor record
121
124
  *
122
125
  * @returns {[k: string, v: any]}
123
126
  */
124
127
  const transform = c => {
125
128
  if(c[0]!=='id')
126
129
  return c;
127
- return [ '_id', to_objid(c[1]) ];
130
+ return [ '_id', to_objid(String(c[1])) ];
128
131
  }
129
132
 
130
133
  /**
131
134
  * Convert an API Query into mongo dialect, also sanitize.
132
135
  *
133
136
  *
134
- * @param {import("@storecraft/core/api").ApiQuery} q
137
+ * @param {ApiQuery<any>} q
135
138
  */
136
139
  export const query_to_mongo = (q) => {
137
140
  try {
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @import { ID } from '@storecraft/core/database'
3
+ * @import { BaseType } from '@storecraft/core/api'
4
+ * @import { WithRelations } from './utils.relations.js'
5
+ * @import { Filter } from 'mongodb'
6
+ */
7
+
1
8
  import { ClientSession, ObjectId } from 'mongodb';
2
9
  import { isDef, isUndef, to_objid } from './utils.funcs.js';
3
10
  import { MongoDB } from '../index.js';
@@ -6,12 +13,9 @@ import { zeroed_relations } from './con.shared.js';
6
13
  /**
7
14
  * @template {any} T
8
15
  *
9
- *
10
16
  * @typedef {Object} Relation
11
17
  * @property {ObjectId[]} [ids]
12
- * @property {Record<
13
- * import('@storecraft/core/database').ID, T>
14
- * } [entries]
18
+ * @property {Record<ID, T>} [entries]
15
19
  */
16
20
 
17
21
  /**
@@ -27,7 +31,7 @@ import { zeroed_relations } from './con.shared.js';
27
31
  * Basically creates an ids array and embedded documents for fast retrival.
28
32
  *
29
33
  *
30
- * @template {import('@storecraft/core/api').BaseType} T
34
+ * @template {BaseType} T
31
35
  *
32
36
  *
33
37
  * @param {MongoDB} driver our driver
@@ -50,7 +54,7 @@ export const create_explicit_relation = async (
50
54
  if(isUndef(value))
51
55
  return data;
52
56
 
53
- /** @type {import('@storecraft/core/api').BaseType[]} */
57
+ /** @type {BaseType[]} */
54
58
  const items = Array.isArray(value) ? value : [value];
55
59
 
56
60
  /** @type {WithRelations<any>} */
@@ -328,7 +332,7 @@ export const remove_specific_connection_of_relation = (
328
332
  * @param {MongoDB} driver mongodb driver instance
329
333
  * @param {string} collection the collection from which the `relation` is from
330
334
  * @param {string} relation_name the `relation` name
331
- * @param {import('mongodb').Filter<any>} from_object_filter
335
+ * @param {Filter<any>} from_object_filter
332
336
  * `mongodb` Filter to locate the first document, the from part of the connection
333
337
  * @param {ObjectId} entry_objid the proper `ObjectId` of the entry
334
338
  * @param {ClientSession} [session] client `session` for atomicity purposes
package/types.public.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MongoClientOptions } from 'mongodb';
2
2
 
3
- export { MongoDB, migrateToLatest } from './index.js';
3
+ export { MongoDB, migrateToLatest, MongoVectorStore } from './index.js';
4
4
 
5
5
  export type Config = {
6
6
  /**
@@ -12,6 +12,7 @@ export type Config = {
12
12
  /**
13
13
  * @description the name of the database, if absent, will be infered at init
14
14
  * with env `app.platform.env.MONGODB_NAME`
15
+ * @default 'main'
15
16
  */
16
17
  db_name?: string;
17
18
 
@@ -19,4 +20,5 @@ export type Config = {
19
20
  * @description mongo client options
20
21
  */
21
22
  options?: MongoClientOptions;
22
- }
23
+ }
24
+