@opra/mongodb 1.0.6 → 1.0.7
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.
|
@@ -43,7 +43,7 @@ class MongoCollectionService extends mongo_entity_service_js_1.MongoEntityServic
|
|
|
43
43
|
input,
|
|
44
44
|
options,
|
|
45
45
|
};
|
|
46
|
-
input._id = input._id
|
|
46
|
+
input._id = input._id == null || input._id === '' ? this._generateId(command) : input._id;
|
|
47
47
|
return this._executeCommand(command, async () => {
|
|
48
48
|
const r = await this._create(command);
|
|
49
49
|
if (!command.options?.projection)
|
|
@@ -64,7 +64,10 @@ class MongoNestedService extends mongo_service_js_1.MongoService {
|
|
|
64
64
|
input,
|
|
65
65
|
options,
|
|
66
66
|
};
|
|
67
|
-
input[this.nestedKey] =
|
|
67
|
+
input[this.nestedKey] =
|
|
68
|
+
input[this.nestedKey] == null || input[this.nestedKey] === ''
|
|
69
|
+
? this._generateId(command)
|
|
70
|
+
: input[this.nestedKey];
|
|
68
71
|
return this._executeCommand(command, async () => {
|
|
69
72
|
const r = await this._create(command);
|
|
70
73
|
if (!options?.projection)
|
|
@@ -105,7 +108,10 @@ class MongoNestedService extends mongo_service_js_1.MongoService {
|
|
|
105
108
|
input,
|
|
106
109
|
options,
|
|
107
110
|
};
|
|
108
|
-
input[this.nestedKey] =
|
|
111
|
+
input[this.nestedKey] =
|
|
112
|
+
input[this.nestedKey] == null || input[this.nestedKey] === ''
|
|
113
|
+
? this._generateId(command)
|
|
114
|
+
: input[this.nestedKey];
|
|
109
115
|
return this._executeCommand(command, () => this._create(command));
|
|
110
116
|
}
|
|
111
117
|
async _create(command) {
|
|
@@ -39,7 +39,7 @@ export class MongoCollectionService extends MongoEntityService {
|
|
|
39
39
|
input,
|
|
40
40
|
options,
|
|
41
41
|
};
|
|
42
|
-
input._id = input._id
|
|
42
|
+
input._id = input._id == null || input._id === '' ? this._generateId(command) : input._id;
|
|
43
43
|
return this._executeCommand(command, async () => {
|
|
44
44
|
const r = await this._create(command);
|
|
45
45
|
if (!command.options?.projection)
|
|
@@ -60,7 +60,10 @@ export class MongoNestedService extends MongoService {
|
|
|
60
60
|
input,
|
|
61
61
|
options,
|
|
62
62
|
};
|
|
63
|
-
input[this.nestedKey] =
|
|
63
|
+
input[this.nestedKey] =
|
|
64
|
+
input[this.nestedKey] == null || input[this.nestedKey] === ''
|
|
65
|
+
? this._generateId(command)
|
|
66
|
+
: input[this.nestedKey];
|
|
64
67
|
return this._executeCommand(command, async () => {
|
|
65
68
|
const r = await this._create(command);
|
|
66
69
|
if (!options?.projection)
|
|
@@ -101,7 +104,10 @@ export class MongoNestedService extends MongoService {
|
|
|
101
104
|
input,
|
|
102
105
|
options,
|
|
103
106
|
};
|
|
104
|
-
input[this.nestedKey] =
|
|
107
|
+
input[this.nestedKey] =
|
|
108
|
+
input[this.nestedKey] == null || input[this.nestedKey] === ''
|
|
109
|
+
? this._generateId(command)
|
|
110
|
+
: input[this.nestedKey];
|
|
105
111
|
return this._executeCommand(command, () => this._create(command));
|
|
106
112
|
}
|
|
107
113
|
async _create(command) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/mongodb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Opra MongoDB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"valgen": "^5.10.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@opra/common": "^1.0.
|
|
15
|
-
"@opra/core": "^1.0.
|
|
16
|
-
"@opra/http": "^1.0.
|
|
14
|
+
"@opra/common": "^1.0.7",
|
|
15
|
+
"@opra/core": "^1.0.7",
|
|
16
|
+
"@opra/http": "^1.0.7",
|
|
17
17
|
"mongodb": ">= 6.0.0"
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|