[SERVER-22385] Mongo client unable to load js file Created: 31/Jan/16  Updated: 31/Jan/16  Resolved: 31/Jan/16

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Narayana B Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

1) [narayana@xeon mongodb-linux-x86_64-rhel62-3.2.1]$ pwd
/tmp/mongodb-linux-x86_64-rhel62-3.2.1
2) [narayana@xeon mongodb-linux-x86_64-rhel62-3.2.1]$ cat myReplicaSetConf.js
{
"_id" : "rs0",
"version" : 1,
"members" : [

{"_id":0, "host": "localhost:27017"}

,

{"_id":1, "host": "localhost:27018"}

,

{"_id":2, "host": "localhost:27019"}

]
}

3) bin/mongo --nodb --port 27017 myReplicaSetConf.js

Error

[narayana@xeon mongodb-linux-x86_64-rhel62-3.2.1]$ bin/mongo --nodb --port 27017 myReplicaSetConf.js
MongoDB shell version: 3.2.1
2016-01-31T15:12:38.206+0530 E QUERY [thread1] SyntaxError: missing ; before statement @myReplicaSetConf.js:2:8

failed to load: myReplicaSetConf.js



 Comments   
Comment by Stennie Steneker (Inactive) [ 31/Jan/16 ]

Hi Narayana,

The content of your "myReplicaSetConf.js" file is a JSON document rather than JavaScript code, so the error message is expected.

Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag, where your question will reach a larger audience.

If you do ask for help on a community forum, I would also suggest including a description of what you are trying to achieve. Replica set configuration is normally managed in the mongo shell using the rs.conf() helper (as per the Deploy a Replica Set tutorial).

Regards,
Stephen

Comment by Narayana B [ 31/Jan/16 ]

Please check the mongo help

[narayana@xeon mongodb-linux-x86_64-rhel62-3.2.1]$ bin/mongo --help
MongoDB shell version: 3.2.1
usage: bin/mongo [options] [db address] [file names (ending in .js)]

Generated at Thu Feb 08 04:00:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.