Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using replicaSet and readPreference option #374

Open
alicehelen opened this issue Apr 18, 2019 · 1 comment
Open

Using replicaSet and readPreference option #374

alicehelen opened this issue Apr 18, 2019 · 1 comment

Comments

@alicehelen
Copy link

We were using mongojs version 0.18.2 and node version 4.4.0 and the connection string we used was
mongodb://dbName:userId@a:27018,b:27018,c:27018/dbName?readPreference=secondaryPreferred&maxStalenessSeconds=120

The connection was successful and all the writes were going to primary server a:27018 and reads were going to secondary servers b:27018 and c:27018.

Now when we upgraded the node version to 10.15, we also upgraded the mongojs to latest version 2.6.0. When we tried to use the same connection string, it gave error that replicaSet option is mandatory. So we modified the connection string to use replicaSet like
mongodb://dbName:userId@a:27018,b:27018,c:27018/dbName?readPreference=secondaryPreferred&maxStalenessSeconds=120&replicaSet=qa

With the new connection string, all the reads and writes are going to primary server and there are no read calls to secondary server even though the readPreference=secondaryPreferred option is present. Can you please check this issue?

Note: If we change the readPreference to secondary instead of secondaryPreferred, then we get cursor error wireProtocolHandler is null

@alicehelen
Copy link
Author

Can anyone please help to look into this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant