vanta-api 1.2.1 → 1.2.2
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 +1 -1
- package/src/api-features.js +5 -2
package/package.json
CHANGED
package/src/api-features.js
CHANGED
|
@@ -313,10 +313,13 @@ export class ApiFeatures {
|
|
|
313
313
|
|
|
314
314
|
_getCollectionInfo(field) {
|
|
315
315
|
const path = this.model.schema.path(field);
|
|
316
|
-
if (!path?.options?.ref)
|
|
316
|
+
if (!path?.options?.ref && !path?.options?.type[0]?.ref)
|
|
317
317
|
throw new HandleERROR(`Invalid populate: ${field}`, 400);
|
|
318
318
|
|
|
319
|
-
const refModelName =
|
|
319
|
+
const refModelName =
|
|
320
|
+
path?.options?.ref?.toLowerCase() ||
|
|
321
|
+
path?.options?.type[0]?.ref.toLowerCase();
|
|
322
|
+
|
|
320
323
|
const collectionName = pluralize(refModelName);
|
|
321
324
|
|
|
322
325
|
return {
|