diff --git a/packages/bitcore-node/src/models/transaction.ts b/packages/bitcore-node/src/models/transaction.ts index 1fe2a654afe..d26e63f67bf 100644 --- a/packages/bitcore-node/src/models/transaction.ts +++ b/packages/bitcore-node/src/models/transaction.ts @@ -398,6 +398,9 @@ export class TransactionModel extends BaseModel { .map(wallet => wallet.wallet); mintOp.updateOne.update.$set.wallets = transformedWallets; delete mintOp.updateOne.update.$setOnInsert.wallets; + if (!Object.keys(mintOp.updateOne.update.$setOnInsert).length) { + delete mintOp.updateOne.update.$setOnInsert; + } return mintOp; }); } @@ -436,6 +439,9 @@ export class TransactionModel extends BaseModel { if (sameBlockSpend) { sameBlockSpend.updateOne.update.$set.spentHeight = height; delete sameBlockSpend.updateOne.update.$setOnInsert.spentHeight; + if (!Object.keys(sameBlockSpend.updateOne.update.$setOnInsert).length) { + delete sameBlockSpend.updateOne.update.$setOnInsert; + } sameBlockSpend.updateOne.update.$set.spentTxid = tx._hash; continue; }