I have the problem with
// Server
Meteor.methods({
myMethod: function(){
return Collection.customer.find();
}
})
// Client
var data = ReactiveMethod.call('myMethod');
Can’t get the data. please help me.
I have the problem with
// Server
Meteor.methods({
myMethod: function(){
return Collection.customer.find();
}
})
// Client
var data = ReactiveMethod.call('myMethod');
Can’t get the data. please help me.
Try returning Collection.customer.find().fetch()
Work fine, why I can’t use return Collection.find()
directly.
From the documention:
Calling methods on the server defines functions that can be called remotely by clients. They should return an EJSON-able value or throw an exception.
find()
returns a cursor, which is not an EJSON-able value, whereas fetch()
returns an array, which is.