diff --git a/package.json b/package.json index 452b3c1..2bbd4a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nicky-lenaers/mogr", - "version": "1.6.0", + "version": "1.6.1", "description": "MoGr dynamically maps GraphQL AST's to Mongoose Query Projection and/or Population and provides GraphQL Cursor Pagination.", "main": "lib/index.js", "scripts": { diff --git a/src/registry.ts b/src/registry.ts index dff9921..30aaef2 100644 --- a/src/registry.ts +++ b/src/registry.ts @@ -183,6 +183,10 @@ export class Registry { fields: PopulatableField[] = [] ): PopulatableField[] { + if (!type) { + return [] + } + if (type.ref && typeof type.ref === 'string') { if (!fields.map(field => field.path).includes(path)) {