Understanding “Not permitted. Untrusted code may only update documents by ID.” Meteor error

From the Meteor blog: Changes to allow/deny rules Starting in 0.5.8, client-only code such as event handlers may only update or remove a single document at a time, specified by _id. Method code can still use arbitrary Mongo selectors to manipulate any number of documents at once. To run complex updates from an event handler, … Read more

How do you secure the client side MongoDB API?

While there is no documented way to do this yet, here’s some code that should do what you want: Foo = new Meteor.Collection(“foo”); … if (Meteor.is_server) { Meteor.startup(function () { Meteor.default_server.method_handlers[‘/foo/insert’] = function () {}; Meteor.default_server.method_handlers[‘/foo/update’] = function () {}; Meteor.default_server.method_handlers[‘/foo/remove’] = function () {}; }); } This will disable the default insert/update/remove methods. Clients … Read more

Meteor + Blaze – If else statement

Spacebars uses the same control flow structure as handlebars so the answer is the same as this one. In your case: {{#if en}} {{text.en}} {{else}} {{#if tc}} {{text.tc}} {{/if}} {{/if}} Side note – one of the nice things about jade is that it supports else if. Sometimes a better alternative is to move the logic … Read more

Cannot compile namespaces when the ‘–isolatedModules’ flag is provided

I faced similar issue in react + ts. I had commented out all my code. Turns out A global file cannot be compiled using ‘–isolatedModules’. Ensure your file contains imports, exports, or an ‘export {}’ statement. So, added something like: export const foo = ‘foo’; or export {} It’s a temporary solution, else you can … Read more

How to format date in meteor template

You may want to create a global helper like: Template.registerHelper(‘formatDate’, function(date) { return moment(date).format(‘MM-DD-YYYY’); }); Then you can use it like: {{#each vname}} {{formatDate date}} {{/each}} This solution depends on moment which is a handy date manipulation library. If you prefer to produce the string without using moment, there are a number of answers for … Read more

How to style Meteor.js loginButtons?

It turns out a combination of the two ideas can be used. After delving into the accounts-ui package, it turns out that it contains only one .less file. The actual template is included in accounts-ui-unstyled, which is automatically included when accounts-ui is added to a meteor project. Hence, the CSS can be removed as follows: … Read more

Meteor.methods returns undefined

This is a perfectly normal behavior: server method calls in Meteor are documented to be asynchronous : On the client, if you do not pass a callback and you are not inside a stub, call will return undefined, and you will have no way to get the return value of the method. It means that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)