I am getting the following error
W20141210-18:14:54.394(5.5)? (STDERR)
W20141210-18:14:54.395(5.5)? (STDERR) /Users/removed/.meteor/packages/meteor-tool/.1.0.36.1phxfod++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141210-18:14:54.395(5.5)? (STDERR) throw(ex);
W20141210-18:14:54.395(5.5)? (STDERR) ^
W20141210-18:14:54.396(5.5)? (STDERR) RangeError: Maximum call stack size exceeded
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
When I am using meteor methods to return a query result.
Meteor.methods({
rquery: function(post){
console.log(post);
var result = AdvtColl.find();
return result;
}
});
I am getting the following error
W20141210-18:14:54.394(5.5)? (STDERR)
W20141210-18:14:54.395(5.5)? (STDERR) /Users/removed/.meteor/packages/meteor-tool/.1.0.36.1phxfod++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141210-18:14:54.395(5.5)? (STDERR) throw(ex);
W20141210-18:14:54.395(5.5)? (STDERR) ^
W20141210-18:14:54.396(5.5)? (STDERR) RangeError: Maximum call stack size exceeded
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
When I am using meteor methods to return a query result.
Meteor.methods({
rquery: function(post){
console.log(post);
var result = AdvtColl.find();
return result;
}
});
Share
Improve this question
asked Dec 10, 2014 at 12:52
rekureku
7639 silver badges17 bronze badges
0
1 Answer
Reset to default 8You can't return a cursor from a method - only EJSON. In your code, result
is the result of a find
call, which is a cursor - you need to either use findOne
or add fetch()
after the find()
to return the document(s) in question.
var result = AdvtColl.findOne(); // RETURNS A DOCUMENT
var result = AdvtColl.find().fetch(); // RETURNS AN ARRAY OF DOCS (EVEN IF THERE'S ONLY ONE OF THEM)