I’m trying to perform the lecture instructions for “Reads and Writes on Replica Sets”.
- The replica set is started. I’ve verified that by running rs.isMaster() from the primary.
- I’ve created the collection newDB.new_collection.
- I’ve inserted the document {student: “Matt Javaly”, grade: “A+”} into new_collection.
- I successfully connected directly to one of the secondaries using the command:
mongo --host “192.168.103.100:27002” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin” - I issued the command “show dbs”. That failed with the expected error. So far so good.
- I issued the command “rs.slaveOK” which returned the unexpected error:
2019-06-29T15:07:14.432+0000 E QUERY [thread1] TypeError: rs.slaveOK is not a function :
@(shell):1:1
Does anyone know why rs.slaveOK() is not a function? Thanks.