Errmsg bad digit "\" when parsing port 30000 code 93

So, I follow the MongoDB Pluralsight tutorial, and I managed to create a, b and c database on the same machine. After successfully creating all three, I run mongo on port 30000, which is the port for my main database.

>mongo --port 30000

He displayed a connection to the port, and then I dialed

db.getMongo ()

He made a connection to the address

And I typed a javascript object as did the guy on Pluralsight that goes

>var democonfig={ _id: "demo", members: [{ _id: 0, host: 'localhost: 30000', priority: 10}, { _id: 1, host: 'localhost: 40000'}, { _id: 2, host: 'localhost: 50000', arbiterOnly: true}] };

After I hit enter, I tried to run rs.initiate with the democonfig file

rs.initiate(democonfig)

This is the error I get:

{ "ok" : 0, "errmsg" : "Bad digit \" \" while parsing 30000", "code" : 93 }

This is what my replicaSet bat file looks like.

cd \Pluralsight\

md \Pluralsight\db1
md \Pluralsight\db2
md \Pluralsight\db3

@REM Primary
start "a" c:\MongoDB\bin\mongod.exe --dbpath ./db1 --port 30000 --replSet "demo"

@REM Secondary
start "b" c:\MongoDB\bin\mongod.exe --dbpath ./db2 --port 40000 --replSet "demo"

@REM Arbiter
start "c" c:\MongoDB\bin\mongod.exe --dbpath ./db3 --port 50000 --replSet "demo"
+5
source share
3 answers

Pluralsight: " MongoDb". , " ":

{
    "_id": "demo",
    "members": [
        {
            "_id": 0,
            "host": "localhost:30000",
            "priority": 10
        },
        {
            "_id": 1,
            "host": "localhost:40000"
        },
        {
            "_id": 2,
            "host": "localhost:50000",
            "arbiterOnly": true
        }
    ]
}
+9

! javascript, .

+6

I just removed the space between localhost: and the port number (localhost: 30000) and the same for the other 2 hosts. It worked fine.

+2
source

Source: https://habr.com/ru/post/1607862/


All Articles