I'm trying to return a MongoDB cursor from a MeteorJS server side method. I can return the array to the server side but can't figure out how to pass it back into the client. What's the best way to do this?
//current server side
if (Meteor.isServer) {
Meteor.methods({
'mongo.updateSearchQuery' (searchQuery) {
var queryCursor = remoteEvents.find({
$text: {
$search: searchQuery
}
}).fetch()
console.log(queryCursor);
return (
queryCursor
)
}
});
}
//current client side
callMongoTextSearch() {
var searchQuery = this.state.searchQuery;
var searchQuery = Meteor.call('mongo.updateSearchQuery', searchQuery);
console.log(searchQuery);
}