Problem with return data of "Collection.Customer.find()" on "Meteor.method()"?

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()

1 Like

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.

1 Like

What is ReactiveMethod?

EDIT: reactive-method package