Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing of sent messages fails. #731

Closed
toreau opened this issue Sep 8, 2015 · 4 comments
Closed

Editing of sent messages fails. #731

toreau opened this issue Sep 8, 2015 · 4 comments

Comments

@toreau
Copy link

toreau commented Sep 8, 2015

Whenever I try to edit a sent message (i.e. a message written in a room) this error messages pops up in the logs:

Exception while invoking method 'updateMessage' MongoError: Mod on _id not allowed
    at Object.Future.wait (/var/www/rocket.chat/bundle/programs/server/node_modules/fibers/future.js:398:15)
    at [object Object].<anonymous> (packages/meteor/helpers.js:119:1)
    at [object Object].MongoConnection.(anonymous function) [as update] (packages/mongo/mongo_driver.js:678:1)
    at OptimizedApply (packages/meteorhacks:kadira/lib/utils.js:35:1)
    at Object.ret.(anonymous function) (packages/meteorhacks:kadira/lib/hijack/db.js:20:1)
    at Object.fields (packages/matb33:collection-hooks/update.js:75:1)
    at Object.collection.(anonymous function) [as update] (packages/matb33:collection-hooks/collection-hooks.js:103:1)
    at [object Object].Mongo.Collection.(anonymous function) (packages/mongo/collection.js:575:1)
    at [object Object].Mongo.Collection.(anonymous function) [as update] (packages/dispatch:run-as-user/lib/collection.overwrites.js:51:1)
    at [object Object].Meteor.methods.updateMessage (server/methods/updateMessage.coffee:33:15)
    - - - - -
    at Object.toError (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/utils.js:114:11)
    at /var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/collection/core.js:636:22
    at Server.Base._callHandler (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
    at /var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/server.js:487:18
    at [object Object].MongoReply.parseBody (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at [object Object].<anonymous> (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/server.js:445:20)
    at [object Object].emit (events.js:95:17)
    at [object Object].<anonymous> (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
    at [object Object].emit (events.js:98:17)
    at Socket.<anonymous> (/var/www/rocket.chat/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:440:22)
@Sing-Li
Copy link
Member

Sing-Li commented Sep 8, 2015

@toreau THANK YOU for submitting this! We've been trying to hunt this down for a while. All reports so far have not been too helpful, and fingered Meteor compatibility. But your detailed log helped us to find the exact culprit in our own code.

In any case, you can either:

  • wait for our fix very shortly - when we close this issue

OR

  • upgrade your MongoDB to a newer version (this should only happens with Mongo 2.4 or earlier - which Meteor supported solidly for a very long time)

@rodrigok - it appears to be a Mongo 2.4 compatibility issue after all, please see:

https://github.com/RocketChat/Rocket.Chat/blob/master/server/methods/updateMessage.coffee#L37

This line will update the _id field, which is not allowed in 2.4. If we assign the id to a temp var, then delete _id from the message before $set - it should work. I'm creating a quick PR. Please verify.

@toreau
Copy link
Author

toreau commented Sep 8, 2015

Glad to be of help, but I already run MongoDB 2.4.9. Are you saying that this problem affects all 2.4.x versions?

rodrigok added a commit that referenced this issue Sep 8, 2015
…sage

fix edit msg with older mongodb - closes #731
@toreau
Copy link
Author

toreau commented Sep 8, 2015

Just upgraded Rocket.Chat, and can confirm that the fix works for me as well. 😄

@geekgonecrazy
Copy link
Contributor

Glad to see this was is fixed. We do need to probably still recommend people use 2.6 or 3.0 since these are officially supported. I think instructions were recently updated on the wiki by the last person to encounter this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants