@orion-js/mongodb 3.3.7 → 3.3.8

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.
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const helpers_1 = require("@orion-js/helpers");
4
4
  const bson_1 = require("bson");
5
5
  const getIdGenerator = (options) => {
6
- if (options.idGeneration === 'random') {
7
- const prefix = options.idPrefix || '';
8
- const random = (0, helpers_1.generateId)();
9
- return () => `${prefix}${random}`;
6
+ if (options.idPrefix || options.idGeneration === 'random') {
7
+ return () => {
8
+ const prefix = options.idPrefix || '';
9
+ const random = (0, helpers_1.generateId)();
10
+ return `${prefix}${random}`;
11
+ };
10
12
  }
11
13
  return () => {
12
14
  const id = new bson_1.ObjectID();
@@ -111,7 +111,7 @@ export interface CreateCollectionOptions<ModelClass extends ModelClassBase = Mod
111
111
  */
112
112
  idGeneration?: 'mongo' | 'random';
113
113
  /**
114
- * ID prefix. Only used if idGeneration is random. Recommended for type checking
114
+ * ID prefix. idGeneration will be forced to random. Recommended for type checking
115
115
  */
116
116
  idPrefix?: ModelClass['_id'];
117
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/mongodb",
3
- "version": "3.3.7",
3
+ "version": "3.3.8",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "96be819f20c79ca01714dfc0c33a7dd38b78915e"
44
+ "gitHead": "78e2d748683f8b4df0e78d349eb05cb6da56e910"
45
45
  }