meteor

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

不打扰是莪最后的温柔 提交于 2019-12-22 05:20:02
问题 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

Encrypt Mongo data in Meteorjs

陌路散爱 提交于 2019-12-22 05:09:13
问题 Is it possible to encrypt certain Mongodb field for particular collection when the document is being inserted? And then decrypt it while publishing the collection? 回答1: I'm not sure if this is overkill for your use case: Mylar is a Meteor module which supports client-side encryption. Mylar stores only encrypted data on the server, and decrypts data only in users' browsers. [...] Mylar allows the server to perform keyword search over encrypted documents, even if the documents are encrypted

Meteor.user() returns undefined after page reload

为君一笑 提交于 2019-12-22 04:55:14
问题 Thing is I want to check if the user is is logged in via Meteor.user() within onBeforeAction in my routes. Problem is, after a page reload Meteor.user() returns undefined for a split second before it gets loaded. Here my route config: Router.map(function() { this.route('list', { path: '/list', template: 'list', onBeforeAction: function(){ console.log('onBeforeAction'); if(!Meteor.user()){ Router.go('/login'); } this.next(); } }); }); I googled a lot and the workarounds with "waitOn" and

When do Template.currentData() and template.data differ in value?

怎甘沉沦 提交于 2019-12-22 04:38:11
问题 I know one is a reactive source, while the other is not. But I thought they would always give the same value. Then I found the following code in Telescope's source: var newTerms = Template.currentData().terms; // ⚡ reactive ⚡ if (!_.isEqual(newTerms, instance.data.terms)) { instance.postsLimit.set(instance.data.terms.limit || Settings.get('postsPerPage', 10)); } link: https://github.com/TelescopeJS/Telescope/blob/master/packages/telescope-posts/lib/client/templates/posts_list/posts_list

How can I use NewRelic for my Meteor application?

亡梦爱人 提交于 2019-12-22 04:31:42
问题 I'm hosting my Meteor app on Heroku and would like to have more monitoring capabilities rather than heroku logs --tail . NewRelic could be a good option, though its node.js agent is still in beta. Does anybody tried to use it with Meteor app? 回答1: Old answer available below. UPDATE FOR 2014: Meteor version as of time of writing: 0.9.4 . sweet. almost at 1.0! OK I decided to edit this as this still gets upvotes with it being very outdated now. As of Meteor 0.7+ or around that (can't remember

How can I use if condition on the meteor template?

左心房为你撑大大i 提交于 2019-12-22 04:12:37
问题 I want to use an if condition in a Meteor Blaze template. Let's say you have a helper users on the Users collection you want to iterate through tasks and if the username is admin, use a "red" style: <ul> {{#each users}} <li {{#if(name==admin)}}class="red"{{/if}}>{{name}}</li> {{/each}} </ul> 回答1: Meteor uses Spacebars, a variant of Handlebars, which are "logicless" templates. You need to define a Template helper, then use it in the {{#if}} . Template.foo.helpers({ isAdmin: function (name) {

How to use React Module CSS in Meteor 1.3 beta

别来无恙 提交于 2019-12-22 03:36:09
问题 EDIT: Meteor 1.3 release is out and a npm package is about to be released allowing a direct use of CSS modules without Webpack I would like to use https://github.com/gajus/react-css-modules in Meteor 1.3 via NPM. But the readme says to use Webpack. I never used Webpack as it seems to me to do the same build job as Meteor. So do you know a way, in this specific case, for using React Module CSS in Meteor 1.3 beta? 回答1: There is actually package for this. MDG is also considering bring webpacks

nodejs googleapis, authClient.request is not a function

岁酱吖の 提交于 2019-12-22 03:34:00
问题 I am creating an oauth2client in one function like so and returning it. I actually do pass in the clien id, secret, redirect url, and credentials. Those are all correct from what I have checked. var OAuth2 = google.auth.OAuth2; var oauth2Client = new OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL); ... credentials = { access_token: accessToken, refresh_token: refreshToken }; oauth2Client.setCredentials(credentials); I then do this in the function where the oauth2client object is returned: var

Can meteor mongo driver handle $each and $position operators?

落爺英雄遲暮 提交于 2019-12-22 02:48:54
问题 I work on a meteor application with meteor bundle up to date. I want to reposition an item within a mongo document array. To achieve that, I $pull it out of the array, and then $push it at a specific index position according to mongoDB documentation. MyCollection.update({_id: my_doc.id}, { $push: { my_array: { $each:[my_item.id], $position:index } } } ) Meteor/Mongo throws the following error: update failed: MongoError: Can't canonicalize query: BadValue unknown top level operator: $each I

Meteor Iron Router with custom waitOn

谁说我不能喝 提交于 2019-12-22 01:17:09
问题 I was wondering whether anyone has built their own waitOn function? I am not using subscribe to drive the waitOn but rather I want to wait on a helper to trigger the ready state, something like this: this.route('edit_Record', { path: '/record/edit/:_id', waitOn: function() { return XXXXX; } }); Template.edit_Record.helpers({ selectedRecord: function () { wait(3000); var x = myRecords.findOne({_id: this.editid}); //XXXXX This is where I want to set 'ready' return x; } }); 回答1: I've designed my