@travetto/model-mongo 2.2.0 → 2.2.3
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/package.json +4 -4
- package/src/service.ts +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-mongo",
|
|
3
3
|
"displayName": "MongoDB Model Support",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.3",
|
|
5
5
|
"description": "Mongo backing for the travetto model module.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mongo",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"directory": "module/model-mongo"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^2.2.
|
|
30
|
-
"@travetto/model": "^2.2.
|
|
31
|
-
"@travetto/model-query": "2.2.
|
|
29
|
+
"@travetto/config": "^2.2.3",
|
|
30
|
+
"@travetto/model": "^2.2.3",
|
|
31
|
+
"@travetto/model-query": "2.2.3",
|
|
32
32
|
"mongodb": "^4.8.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
package/src/service.ts
CHANGED
|
@@ -455,7 +455,8 @@ export class MongoModelService implements
|
|
|
455
455
|
const { filter } = MongoUtil.prepareQuery(cls, query);
|
|
456
456
|
let cursor = col.find<T>(filter, {});
|
|
457
457
|
if (query.select) {
|
|
458
|
-
const
|
|
458
|
+
const selectKey = Object.keys(query.select)[0];
|
|
459
|
+
const select = typeof selectKey === 'string' && selectKey.startsWith('$') ? query.select : MongoUtil.extractSimple(query.select);
|
|
459
460
|
// Remove id if not explicitly defined, and selecting fields directly
|
|
460
461
|
if (!select['_id']) {
|
|
461
462
|
const values = new Set([...Object.values(select)]);
|