strange mongodb and mongoose error: not master and slaveOk=false error

后端 未结 5 1286
忘掉有多难
忘掉有多难 2020-12-30 19:34

I\'m getting a strange error in my node.js app

not master and slaveOk=false code 13435

I\'m doing a findOne query using mongoose 4.0.2 hitting a

5条回答
  •  不思量自难忘°
    2020-12-30 20:16

    It is likely your master node failed and you are trying to read from a slave node but by default (and a safety practice such as data synchronization) your reading source is set to primary node only.

    You can attach options at the end of your connection string such as ?readPreference=secondary which will use the secondary connection

提交回复
热议问题