سؤال

I have a simple MongoDb hosted in AppHarbor.com. I successfully connected to it using Robomongo and created a simple collection called 'User' and a function called 'insertUser' using Robomongo. But when I try to call the function in shell I get an "Unauthorized" message. I'm using the free Mongo db account in AppHarbor. Please tell me how to successfully call this function?

enter image description here

هل كانت مفيدة؟

المحلول

So it seems I need to issue the call in the following manner for it to work. Eval doesn't seem to work for some reason though.

db.loadServerScripts("system.js");
insertUser('aaa', 'bbb');

نصائح أخرى

Robomongo is already creating function name. You need only a call.

For you - calling;

insertUser('aaa', 'bbb');

function;

db.User.insert({"UserName":param1,"Password":param2})
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top