Db.collection.find().count() need to still run rs.secondaryOk()

Hi,

I know it is not possible to initially query to a secondary node without executing rs.secondaryOk().

I already have a mongorc.js that contains “rs.secondaryOk()” and it is already pointing it on my connection.

When I try to db.collection.find() it is working fine. But when I try the count, the shell is still needing the “rs.secondaryOk()” script.

Hi there! Welcome to the forum!

Can you please try db.collection.countDocuments()

Please do let us know how this goes!

sorry for the late reply. it still encounters the same error