c2-mongoose 2.1.133 → 2.1.134
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/dist/flow/item/BuildPipelineToCountJoinFlowItem.js +8 -3
- package/dist/flow/item/GetCamellCaseStringFlowItem.d.ts +5 -0
- package/dist/flow/item/GetCamellCaseStringFlowItem.js +11 -0
- package/package.json +1 -1
- package/src/flow/item/BuildPipelineToCountJoinFlowItem.ts +2 -1
- package/src/flow/item/GetCamellCaseStringFlowItem.ts +7 -0
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var GetCamellCaseStringFlowItem_1 = __importDefault(require("./GetCamellCaseStringFlowItem"));
|
|
3
7
|
var BuildPipelineToCountJoinFlowItem = /** @class */ (function () {
|
|
4
8
|
function BuildPipelineToCountJoinFlowItem() {
|
|
5
9
|
}
|
|
6
10
|
BuildPipelineToCountJoinFlowItem.prototype.build = function (joinWith, fieldTarget) {
|
|
11
|
+
var _a;
|
|
7
12
|
return [
|
|
8
13
|
{
|
|
9
14
|
$lookup: {
|
|
@@ -23,9 +28,9 @@ var BuildPipelineToCountJoinFlowItem = /** @class */ (function () {
|
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
30
|
{
|
|
26
|
-
$addFields: {
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
$addFields: (_a = {},
|
|
32
|
+
_a["total".concat(GetCamellCaseStringFlowItem_1.default.get(joinWith.collection.name))] = { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] },
|
|
33
|
+
_a)
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
36
|
$project: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var GetCamellCaseStringFlowItem = /** @class */ (function () {
|
|
4
|
+
function GetCamellCaseStringFlowItem() {
|
|
5
|
+
}
|
|
6
|
+
GetCamellCaseStringFlowItem.prototype.get = function (input) {
|
|
7
|
+
return input.charAt(0).toUpperCase() + input.slice(1);
|
|
8
|
+
};
|
|
9
|
+
return GetCamellCaseStringFlowItem;
|
|
10
|
+
}());
|
|
11
|
+
exports.default = new GetCamellCaseStringFlowItem;
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import mongoose from "mongoose"
|
|
2
|
+
import GetCamellCaseStringFlowItem from "./GetCamellCaseStringFlowItem"
|
|
2
3
|
|
|
3
4
|
class BuildPipelineToCountJoinFlowItem {
|
|
4
5
|
build(joinWith: mongoose.Model<any>, fieldTarget: string): any[] {
|
|
@@ -22,7 +23,7 @@ class BuildPipelineToCountJoinFlowItem {
|
|
|
22
23
|
},
|
|
23
24
|
{
|
|
24
25
|
$addFields: {
|
|
25
|
-
|
|
26
|
+
[`total${GetCamellCaseStringFlowItem.get(joinWith.collection.name)}`]: { $ifNull: [{ $arrayElemAt: ['$matchedDocuments.totalCount', 0] }, 0] }
|
|
26
27
|
}
|
|
27
28
|
},
|
|
28
29
|
{
|