c2-mongoose 2.1.389 → 2.1.391

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.
@@ -33,16 +33,12 @@ var OneToManyFlowItem = /** @class */ (function () {
33
33
  },
34
34
  ];
35
35
  collection = __spreadArray(__spreadArray([], collection, true), populateClauseLookup, true);
36
- var model = global.connectionMongoose.model(foreing.collectionChild);
37
- // let model = mongoose.connection.models[
38
- // Object.keys(mongoose.connection.models).find(
39
- // key => mongoose.connection.models[key].collection.name === foreing.collectionChild
40
- // )!
41
- // ];
36
+ // const model = (global as any).connectionMongoose.model(foreing.collectionChild);
37
+ var model = global.connectionMongoose.models[Object.keys(global.connectionMongoose.models).find(function (key) { return global.connectionMongoose.models[key].collection.name === foreing.collectionChild; })];
42
38
  console.info("finding", foreing.collectionChild);
43
39
  console.info("model", model);
44
40
  if (model) {
45
- var populates = populate.split(" ").filter(function (p) { return p.startsWith(labeled); });
41
+ var populates = populate.replace(" ", "").split(",").filter(function (p) { return p.startsWith(labeled); });
46
42
  console.info("iterate", populates);
47
43
  for (var _i = 0, populates_1 = populates; _i < populates_1.length; _i++) {
48
44
  var populate_1 = populates_1[_i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.389",
3
+ "version": "2.1.391",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,17 +25,17 @@ class OneToManyFlowItem {
25
25
 
26
26
  collection = [...collection, ...populateClauseLookup]
27
27
 
28
- const model = (global as any).connectionMongoose.model(foreing.collectionChild);
29
- // let model = mongoose.connection.models[
30
- // Object.keys(mongoose.connection.models).find(
31
- // key => mongoose.connection.models[key].collection.name === foreing.collectionChild
32
- // )!
33
- // ];
28
+ // const model = (global as any).connectionMongoose.model(foreing.collectionChild);
29
+ let model = (global as any).connectionMongoose.models[
30
+ Object.keys((global as any).connectionMongoose.models).find(
31
+ key => (global as any).connectionMongoose.models[key].collection.name === foreing.collectionChild
32
+ )!
33
+ ];
34
34
  console.info("finding", foreing.collectionChild)
35
35
  console.info("model", model)
36
36
 
37
37
  if (model) {
38
- const populates = populate.split(" ").filter((p: string) => p.startsWith(labeled))
38
+ const populates = populate.replace(" ", "").split(",").filter((p: string) => p.startsWith(labeled))
39
39
 
40
40
  console.info("iterate", populates)
41
41
  for (const populate of populates) {