Info; rs.slave() is deprecated. use rs.secondaryOk()

While running the exercises for Chapter 2 “Reads and Writes on replica set”,
i got a warning that rs.slaveOk() is deprecated.
I’m running mongodb 4.4.4.

Hi @Alfonso_Villanueva,

Welcome to the MongoDB Community Forums

Yes, from MongoDB version 4.4 onwards, you might get a warning displayed like:

WARNING: slaveOk() is deprecated and may be removed in the next major release. 
Please use secondaryOk() instead.

So, please prefer using rs.secondaryOk()

For more information have a look here

Thanks,
Kushagra

2 Likes