c2-mongoose 2.1.209 → 2.1.211
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.
|
@@ -10,11 +10,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var
|
|
14
|
+
var Utils_1 = require("../../utils/Utils");
|
|
18
15
|
var BuildSelectSingleFlowItem = /** @class */ (function () {
|
|
19
16
|
function BuildSelectSingleFlowItem() {
|
|
20
17
|
}
|
|
@@ -30,10 +27,10 @@ var BuildSelectSingleFlowItem = /** @class */ (function () {
|
|
|
30
27
|
};
|
|
31
28
|
BuildSelectSingleFlowItem.prototype.buildProjectionNested = function (model, projectCurrent, field, include) {
|
|
32
29
|
var _a = field.split('.'), first = _a[0], rest = _a.slice(1);
|
|
33
|
-
if (first
|
|
30
|
+
if ((0, Utils_1.isNotEmpty)(first) && (0, Utils_1.isNotEmpty)(rest)) {
|
|
34
31
|
var campoInfo = model.schema.path(first);
|
|
35
32
|
// Verifique se o tipo do campo é mongoose.Types.ObjectId
|
|
36
|
-
if (campoInfo
|
|
33
|
+
if (campoInfo.instance === "ObjectID") {
|
|
37
34
|
console.log('O campo é um Types.ObjectId');
|
|
38
35
|
return undefined;
|
|
39
36
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose"
|
|
2
|
+
import { isNotEmpty } from "../../utils/Utils"
|
|
2
3
|
|
|
3
4
|
class BuildSelectSingleFlowItem {
|
|
4
5
|
|
|
@@ -20,12 +21,12 @@ class BuildSelectSingleFlowItem {
|
|
|
20
21
|
buildProjectionNested(model: mongoose.Model<any>, projectCurrent: any, field: string, include: boolean) {
|
|
21
22
|
let [first, ...rest] = field.split('.')
|
|
22
23
|
|
|
23
|
-
if (first
|
|
24
|
+
if (isNotEmpty(first) && isNotEmpty(rest)){
|
|
24
25
|
|
|
25
26
|
const campoInfo = model.schema.path(first);
|
|
26
27
|
|
|
27
28
|
// Verifique se o tipo do campo é mongoose.Types.ObjectId
|
|
28
|
-
if (campoInfo
|
|
29
|
+
if (campoInfo.instance === "ObjectID") {
|
|
29
30
|
console.log('O campo é um Types.ObjectId');
|
|
30
31
|
return undefined
|
|
31
32
|
}
|