Fix aggregate group id (#5994)

* Fix aggregate group id

* Improve implementation

* Add test case

* Fix postgres test - it does not work with group and sort at same time
This commit is contained in:
Antonio Davi Macedo Coelho de Castro
2019-09-01 22:34:36 -07:00
committed by GitHub
parent 5a482bd661
commit ac353ca8c2
2 changed files with 29 additions and 1 deletions

View File

@@ -799,7 +799,12 @@ export class MongoStorageAdapter implements StorageAdapter {
if (isPointerField && result._id) {
result._id = result._id.split('$')[1];
}
if (result._id == null || _.isEmpty(result._id)) {
if (
result._id == null ||
result._id == undefined ||
(['object', 'string'].includes(typeof result._id) &&
_.isEmpty(result._id))
) {
result._id = null;
}
result.objectId = result._id;