Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor: Match error: Failed Match.OneOf or Match.Optional validation (websocket)

I have a website that uses Meteor 0.9. I have deployed this website on OpenShift (http://www.truthpecker.com).

The problem I'm experiencing is that when I go to a path on my site (/discover), then sometimes (though not always), the data needed are not fetched by Meteor. Instead I get the following errors:

On the client side:

WebSocket connection to 'ws://www.truthpecker.com/sockjs/796/3tfowlag/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 

And on the server side:

Exception from sub rD8cj6FGa6bpTDivh Error: Match error: Failed Match.OneOf or Match.Optional validation
    at checkSubtree (packages/check/match.js:222)
    at check (packages/check/match.js:21)
     at _.extend._getFindOptions (packages/mongo-livedata/collection.js:216)
    at _.extend.find (packages/mongo-livedata/collection.js:236)
    at Meteor.publish.Activities.find.user [as _handler] (app/server/publications.js:41:19)
    at maybeAuditArgumentChecks (packages/livedata/livedata_server.js:1492)
    at _.extend._runHandler (packages/livedata/livedata_server.js:914)
    at _.extend._startSubscription (packages/livedata/livedata_server.js:764)
    at _.extend.protocol_handlers.sub (packages/livedata/livedata_server.js:577)
    at packages/livedata/livedata_server.js:541
Sanitized and reported to the client as: Match failed [400]

Can anyone help me to eliminate this error and get the site working? I'd be very grateful!

Tony

P.S.: I never got this error using localhost.

EDIT:

The line causing the problem the problem is this (line 41):

return Activities.find({user: id}, {sort: {timeStamp: -1}, limit:40});

One document in the activities collection looks like this:

{
    "user" : "ZJrgYm34rR92zg6z7",
    "type" : "editArg",
    "debId" : "wtziFDS4bB3CCkNLo",
    "argId" : "YAnjh2Pu6QESzHQLH",
    "timeStamp" : ISODate("2014-09-12T22:10:29.586Z"),
    "_id" : "sEDDreehonp67haDg"
}

When I run the query done in line 41 in mongo shell, I get the following error:

error: { "$err" : "Unsupported projection option: timeStamp", "code" : 13097 }

I don't really why this is though. Can you help me there as well? Thank you.

like image 303
tomet Avatar asked Sep 29 '14 16:09

tomet


1 Answers

Make sure that you are passing an integer to skip and limit. Use parseInt() if need be.

like image 131
JoeTidee Avatar answered Nov 17 '22 02:11

JoeTidee