Exception in callback of getAsset Error: Update parameter cannot have both modifier and non-modifier fields


#1

Hello,

I am facing a strange issue… when upsert a document. In one case it is working in another it is not…

Not working case:
let document = CollectionTest.upsert({name: this.item.name}, {
test: this.item.test,
fullName: this.item.fullName,
$addToSet: {
source: {‘name’: this.item.sourceName, ‘id’: this.item.sourceId}
}
}
);

Error:
I20160518-00:02:00.981(3)? Exception in callback of getAsset Error: Update parameter cannot have both modifier and non-modifier fields.
I20160518-00:02:00.982(3)? at isModificationMod (packages/mongo/mongo_driver.js:588:11)
I20160518-00:02:00.982(3)? at MongoConnection.update (packages/mongo/mongo_driver.js:512:20)
I20160518-00:02:00.983(3)? at MongoConnection. (packages/meteor/helpers.js:118:1)
I20160518-00:02:00.984(3)? at MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:736:49)
I20160518-00:02:00.984(3)? at Object.collection.(anonymous function) [as update] (packages/matb33_collection-hooks/collection-hooks.js:104:1)
I20160518-00:02:00.986(3)? at [object Object].update (packages/mongo/collection.js:568:29)
I20160518-00:02:00.986(3)? at [object Object].upsert (packages/mongo/collection.js:655:15)
I20160518-00:02:00.987(3)? at packages/matb33_collection-hooks/upsert.js:96:1
I20160518-00:02:00.987(3)? at [object Object].
.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160518-00:02:00.988(3)? at Object.directOp (packages/matb33_collection-hooks/collection-hooks.js:18:1)

Working case:
let document = CollectionTest.upsert({name: this.item.name}, {
$addToSet: {source: {‘sourceName’: this.item.sourceName, ‘sourceId’: this.item.sourceId}}
}
);

Also I had to remove the callback, because in both cases it is not working.

Any ideas, what I am doing wrong here?


#2

I guess, I should have read the error message twice… :slight_smile: Solved it.