Skip to content

Errors Mongodb

FlorinSpuze edited this page Sep 15, 2022 · 1 revision

First you need to set mongo to be replica-set :

connect to the db container (example name: mongodb or samsa-stack-db)

        $sudo docker exec -it samsa-stack /bin/bash

in the container you need to connect to the mongo:

        $ mongo

if this is not working it means that the mongo has a new version and you need to try with

        $ mongosh

inside the mongo  you need to set the replica:

     var cfg = {
      "_id": "rs0",
     "protocolVersion": 1,
     "version": 1,
     "members": [
          {
      "_id": 0,
      "host": "127.0.0.1:27017",
      "priority": 2
      }
    ],settings: {chainingAllowed: true}
       };

next command : 

  rs.initiate(cfg, { force: true });

tes

Clone this wiki locally