Warz
Warz

Reputation: 7776

Meteor - Mongo Write error

I am getting an unexpected error when i attempt an update with the latest version of meteor.js. The type error doesn't specify which field it fails on and i am not sure if this is a mongo related issue or not. Has anyone seen this error before?

Error in Mongo write: TypeError: boolean is not a function
I20130901-19:44:56.515(-5)?     at writeCallback (packages/mongo-livedata/mongo_driver.js:206)
I20130901-19:44:56.515(-5)?     at Meteor.bindEnvironment.runWithEnvironment (packages/meteor/dynamics_nodejs.js:69)

I was able to stop my client from blocking by specifying a callback to the server side call.

https://gist.github.com/warsamebashir/6408451

Upvotes: 3

Views: 1195

Answers (3)

Charles Holbrow
Charles Holbrow

Reputation: 4231

This usually happens to me when I pass {multi:true} as a second argument to Collection.remove on the server.

Upvotes: 5

Danail Gabenski
Danail Gabenski

Reputation: 3690

I'm getting the same thing on this code:

Templates.remove({_id: {$in: templateIDs}}, {multi:true});

Just for the record, I am still on 0.7.0 and this type of query was working perfectly before the 0.8.1 release. How the hell is it affecting the old 0.7.0 without me even updating is beyond comprehension. Did they change the behavior of remove to now automatically do {multi: true} on everything it finds, because that's what I understood from Peppe L-G's link.

Edit1: Follow-up, yes removing the , {multi:true} fixed the problem, while it still does delete all the matched documents in mongodb. It's either me updating mongodb to 2.4.10 from 2.4.9 or they did an update on the 0.7.0 release that fixes Meteor's behavior.

Upvotes: 0

Peppe L-G
Peppe L-G

Reputation: 8360

You're calling Collection.update with 5 arguments, which is a little bit too many. Read about it in the docs.

Upvotes: 1

Related Questions