-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.14
-
Component/s: None
-
Labels:None
-
Environment:Debian linux
I am trying to execute a .js from command line passing an arg to mongo like this:
$ mongo --eval 'var x="Test text"' insertArg.js
insertArg.js looks like this:
function insertArg; {
use PathTrackerDB;
var inputText = x;
var r =
db.remote_history.insert(r);
}
I run the command:
$ mongo --eval 'var x="Test text"' insertArg.js
and I get the following output on the console:
MongoDB shell version: 3.2.10
connecting to: test
$
Then I go into the mongo shell and do a db.remote_history.count() and the collection has not been updated with the new row. I get no information good or bad from the shell script.
Any ideas what I might be doing wrong?
Much appreciated!
Thanks, Karen