diff --git a/src/mongo.db.ts b/src/mongo.db.ts index 49a6bac..f1d03fe 100644 --- a/src/mongo.db.ts +++ b/src/mongo.db.ts @@ -17,6 +17,7 @@ import { AnyObjectWithId, CommonLogger, commonLoggerPrefix, + _assert, } from '@naturalcycles/js-lib' import { ReadableTyped } from '@naturalcycles/nodejs-lib' import { CommandOperationOptions, Filter, MongoClient, MongoClientOptions } from 'mongodb' @@ -112,6 +113,8 @@ export class MongoDB extends BaseCommonDB implements CommonDB { ): Promise { if (!rows.length) return + _assert(!rows.some(r => r.id === null), `id cannot be null in saveBatch`) + const client = await this.client() await client .db(this.cfg.db)