Meteor: match error: failed match. One-way or coincidence. Custom Verification (websocket)

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

The problem that I encountered is that when I go to the path on my site (/ discover), sometimes (though not always) the necessary data is not accepted by the 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 someone help me fix this error and make the site work? I would be very grateful!

Tony

PS: I never got this error using localhost.

EDIT:

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

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

One document in the action collection is as follows:

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

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

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

I really donโ€™t understand why this is so. Can you help me there too? Thanks.

+5
source share
3 answers

Make sure you pass the integer skip and limit . Use parseInt() if necessary.

+4
source

You have a document on your website that does not match your check .

You have confirmation: app/server/publications.js:41

So, this attribute exists somehow like Match.optional(Match.oneOf(xx)) , but the document attribute is not one of the values โ€‹โ€‹in Match.oneOf

You will have to go through your collection documents by calling this, and remove or correct the attribute, making it match your check statement.

Update for your updated question.

You execute the Meteor commands in the meteor mongo / mongo shell. The error you get is not related to the problem in Meteor, for sorting in the mongo shell you would do activities.find(..).sort() instead of activities.find(.., { sort : {..}) . This is not a problem.

The problem is most likely that your id is not really a string. It must be sEDDreehonp67haDg for the document you are looking for. You can use the debugger to find out what it really is.

0
source

I donโ€™t think you can use limit in client side search queries. Removing limit from my request solves the problem. If you are looking for pagination, you can manually manually flip your own by passing a parameter to your โ€œActionsโ€ publication so that the limit is added to the server request along with the offset. There is also this folder package .

0
source

Source: https://habr.com/ru/post/1203640/


All Articles