sdelements / lets-chat

Self-hosted chat app for small teams
http://sdelements.github.io/lets-chat
MIT License
9.76k stars 1.58k forks source link

Failed to parse error in transcript #657

Closed mmeinert closed 8 years ago

mmeinert commented 8 years ago

I have a problem with a new server, when asking for the transcript I get this :

{ [MongoError: Failed to parse: { find: "messages", filter: { room: ObjectId('5683bf59160ecb027d1db327'), posted: { $gt: new Date(1451516400000), $lte: new Date(1451602799999) } }, sort: { posted: 1 }, limit: "5000" }. 'limit' field must be numeric.]
  name: 'MongoError',
  message: 'Failed to parse: { find: "messages", filter: { room: ObjectId(\'5683bf59160ecb027d1db327\'), posted: { $gt: new Date(1451516400000), $lte: new Date(1451602799999) } }, sort: { posted: 1 }, limit: "5000" }. \'limit\' field must be numeric.',
  waitedMS: 0,
  ok: 0,
  errmsg: 'Failed to parse: { find: "messages", filter: { room: ObjectId(\'5683bf59160ecb027d1db327\'), posted: { $gt: new Date(1451516400000), $lte: new Date(1451602799999) } }, sort: { posted: 1 }, limit: "5000" }. \'limit\' field must be numeric.',
  code: 9 }

I'm pretty sure it's related with MongoDB's recent version but I don't know how to fix it.

Release 0.4.5 Debian Jessie Mongodb 3.2.0 npm 1.4.21+ds-2 nodejs 5.3.0-1nodesource1~jessie1 python 2.7.9-2

mmeinert commented 8 years ago

Issue is definitively related to MongoDB, downgrading to 3.0.8 solved the problem. Wiki's page should be adapted with MongoDB's prerequisite set to 2.6≥≤3.0.x

hhaidar commented 8 years ago

It's probably because we pass in a string for limit. Something we can fix.

RobThree commented 8 years ago

Can confirm; MongoDB 3.2.1 here, same problem:

{ [MongoError: Failed to parse: { find: "messages", filter: { room: ObjectId('56a17bf9176c971d2d54b4ae'), posted: { $gt: new Date(1453417200000), $lte: new Date(1453503599999) } }, sort: { posted: 1 }, limit: "5000" }. 'limit' field must be numeric.]
  name: 'MongoError',
  message: 'Failed to parse: { find: "messages", filter: { room: ObjectId(\'56a17bf9176c971d2d54b4ae\'), posted: { $gt: new Date(1453417200000), $lte: new Date(1453503599999) } }, sort: { posted: 1 }, limit: "5000" }. \'limit\' field must be numeric.',
  waitedMS: 0,
  ok: 0,
  errmsg: 'Failed to parse: { find: "messages", filter: { room: ObjectId(\'56a17bf9176c971d2d54b4ae\'), posted: { $gt: new Date(1453417200000), $lte: new Date(1453503599999) } }, sort: { posted: 1 }, limit: "5000" }. \'limit\' field must be numeric.',
  code: 9 }
hmirsky commented 8 years ago

Just installed Mongo 3.0.8 and lets-chat. I'm getting this same error. Wondering if there is an update?

balping commented 8 years ago

Just created a pull request: https://github.com/sdelements/lets-chat/pull/701

Downgrading must never be the first solution. I agree, in some cases it might be the only solution, but this issue can be fixed so easily, I'm surprised that no-one has tried to fix it before

hhaidar commented 8 years ago

@balping thanks, I really appreciate you looking at this.