Our replica set config is invalid or we are not a member of it - MongoDB
As per error it seems like you have not configured properly the replica set. How to setup MongoDB Replica Set , you find here.

For example I am writing the steps here to setup MongoDB Replica Set

1) Start a mongod instance.

2) Start another mongod instance.

3) Start Replication.

After launcing the all mongod node instances, connect to any one node and start the mongo shell then type in command prompt


  rs.initiate()


For example

Now the mongo shell prompt would be changed to yournodeinstancename:PRIMARY>

You may also check the status using rs.status() method.


  rs.status()


for more info about rs.status() see the MongoDB documentation here and here

4) Add a MongoDB instance to the Replica Set.


  rs.add();


5) Check the Status.

You may check the status of the Replica Set by running the following command


  rs.status();


6) Getting an overview of the replica set and if current node is master


  rs.isMaster()


For further your ref here , here , here