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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanta-api",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Advanced API features and security configuration for Node.js/MongoDB.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 = path.options.ref.toLowerCase();
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 {