We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2f857f commit db5bf44Copy full SHA for db5bf44
packages/query-typegoose/src/services/typegoose-query-service.ts
@@ -237,7 +237,11 @@ export class TypegooseQueryService<Entity extends Base>
237
}
238
239
private ensureIdIsNotPresent(e: DeepPartial<Entity>): void {
240
- if (Object.keys(e).find((f) => f === 'id' || f === '_id')) {
+ if (
241
+ Object.keys(e)
242
+ .filter((v) => typeof e[v] !== `undefined`)
243
+ .find((f) => f === 'id' || f === '_id')
244
+ ) {
245
throw new Error('Id cannot be specified when updating or creating');
246
247
0 commit comments