Questions tagged [meteor-methods]

50 questions
7
votes
5 answers

How to prevent invoking 'Meteor.call' from JavaScript Console?

I just noticed that Meteor.call, the concept that prevent user from invoke collection's insert, update, remove method, still able to be invoked from JavaScript console. For client's example: // client ... Meteor.call('insertProduct',…
Teerasej
  • 1,486
  • 4
  • 21
  • 31
4
votes
1 answer

Exception in callback of async function: TypeError: callback is not a function

I cant figure out why my insert query code located in server/main.js is causing this: TypeError: callback is not a function error message. The following code is located at: server/main.js var businessCard = [{PostedDate: moment().add(0,…
SirBT
  • 1,580
  • 5
  • 22
  • 51
4
votes
2 answers

AutoValue not set in AutoForm with Meteor method

I have an insert form which is created using autoform, collection2 and simple schema. The createdBy field is populated with the userId using autovalue. The form worked when using meteor.allow() for the insert but I wanted to replace the allow with a…
2
votes
1 answer

Accounts.changePassword doesn't work in Method

I'm working on a Meteor app, and I want to move a call to Accounts.changePassword from the client to a method. However, when I try to run the method, I get this server error : Exception while invoking method 'setPersonalPassword' TypeError: Object…
Frankie
  • 23
  • 3
2
votes
1 answer

Running code before and after each Method call in Meteor

I´m running several method calls that need to show the end user a loading modal and hide it when the method resturns a result. I was looking for a way to run this pre-call code and post-call code for every method without repeating code. swal({ …
Alan Ortega
  • 189
  • 1
  • 2
  • 7
2
votes
1 answer

Meteor: working with async methods

I am using React with Meteor. I have a method inside React component that calls Meteor.method (which is run on client as well): // index.js loginWithGoogle() { console.log('1') Meteor.call('auth.loginWithGoogle', {}, (err,…
yerassyl
  • 2,958
  • 6
  • 42
  • 68
2
votes
1 answer

Meteor - call method from client & server method

What will happen if from a method that is shared by the client and the server I call another method that is on the server only? Will it get called twice? Only once from the server? Only once from the client? //lib/methods.js Meteor.methods({ test:…
Guig
  • 9,891
  • 7
  • 64
  • 126
2
votes
2 answers

Meteor.call callback is not executed and it's silently ignored if I don't do a fetch

Why if I write this: /client/Items.js Template.Items.onCreated(function() { console.log('Methor.call'); Meteor.call('Items.findAll', function (err, resp) { console.log('Methor.call callback'); // Here I will use resp expecting it…
Andrea
  • 15,900
  • 18
  • 65
  • 84
1
vote
1 answer

Meteor call result has undefined instance variables

The server has a Meteor Method that returns a GiftList object that contains a Gift set. The client has a Meteor Call that prints out the result. The Gift set is undefined even though it is initialised and sent by the server. The instance variables…
Michael
  • 3,411
  • 4
  • 25
  • 56
1
vote
1 answer

Meteor: SSR necessary to secure admin part of application?

I have my extended user model in the Meteor.users collection, which I'm publishing most fields from to the client. Each user has an isAdmin field, set to false by default. Now I have two concerns, which are linked: How to make sure, components…
Wu Wei
  • 1,827
  • 1
  • 15
  • 27
1
vote
0 answers

Meteor Async ValidatedMethod gets called with function parameters undefined

someMethod = new ValidatedMethod({ name: 'someMethodName', validate: new SimpleSchema({ subId: {type: String, min:1}, planId: {type: String} }).validator(), async run(params){ try{ …
ASX
  • 635
  • 7
  • 18
1
vote
0 answers

Web3 API call error in Meteor Autovalue function and collection insert

I am running a Meteor application and faced with an error I cannot figure out. I am using a quick form to insert a document into a collection and one of the fields is a Hash address to be obtained from a web3 api call using auto value. //Schema…
AJJ1994
  • 11
  • 2
1
vote
1 answer

How to save/update object in collection and embed object in object?

I have two collections Colors and Cars. In the car possibly to choose the color. How to save/update object in collection so that embed Color object in Car object? Cars = new Mongo.Collection('cars'); Cars.attachSchema(new SimpleSchema({ …
Viktor Bogutskii
  • 870
  • 1
  • 14
  • 22
1
vote
1 answer

Does a ValidatedMethod is hidden from client if not in server folder?

For bdd CRUD i write my Collection.insert , update, etc in a ValidatedMethod (mdg:validated-method) and call these methods from the client. // /object/methods.js export const insertObject = new ValidatedMethod({ name: 'insertObject', …
Foobyto
  • 119
  • 1
  • 7
1
vote
1 answer

Passing Meteor.userId to validated method when testing

I have a validated method that I am writing a test for. The method checks that a user is an administrator and throws an error if they aren't. I'm using dburles:factory to create a new user with 'administrator' role in the Meteor.users…
Sean
  • 2,609
  • 1
  • 18
  • 34
1
2 3 4