0

I would like to call functions that I have defined in MongoDB with Meteor.js? For example I have a function call hi() in MongoDB. To call it in MongoDB I use this command:

> db.eval('hi()')

What about in Meteor?

2 Answers 2

1
var funcInputObj={};var mongoFuncName='testfunc';
 MongoInternals.defaultRemoteCollectionDriver().mongo.db.eval('db.loadServerScripts();return ' + mongoFuncName+ '(' + JSON.stringify(funcInputObj|| {}) + ');',function (err, mongoFuncReturnData) {


   console.log(mongoFuncReturnData);
 });
Sign up to request clarification or add additional context in comments.

2 Comments

Could you please elaborate more your answer adding a little more description about the solution you provide?
Returns null in the console.
0

Unless someone contradicts me it is not possible yet. Meteor doesn't let you "play" with all Mongo functions.

There are some tracks you can read and dig here.

I wish I could have helped you more, good luck.

1 Comment

thanks for your help. I will try to search for more solutions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.