[JAVA-1784] UpdateUser command does not work with the 3.0.0 driver and 3.x server Created: 29/Apr/15  Updated: 02/Apr/16  Resolved: 04/May/15

Status: Closed
Project: Java Driver
Component/s: Command Operations
Affects Version/s: 3.0.0
Fix Version/s: 3.0.1

Type: Bug Priority: Major - P3
Reporter: Dharshan Rangegowda Assignee: Ross Lawley
Resolution: Done Votes: 0
Labels: regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I am using the 3.0.0 driver to issue the following command to the 3.0.2 server. The goal is to change the password.

BasicDBObject doc = new BasicDBObject("updateUser", "1").
append("updateUser", <USER>).
append("pwd", <passwd>);
.....
private DB dbObj = null;
....
this.dbObj.command(cmd);

The command always fails with the following error -"The server is not the primary and did not execute the operation"

The same command runs fine from the mongo shell.It also runs fine against a 2.6.x server. So basically it fails against a 3.x server.



 Comments   
Comment by Jeffrey Yemin [ 05/May/15 ]

Closed for 3.0.1 release.

Comment by Ross Lawley [ 30/Apr/15 ]

Thanks dharshanr@scalegrid.net for reporting the issue.

This has been fixed and will be released in 3.0.1

Comment by Githook User [ 30/Apr/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Reinstated obedient commands for DB

JAVA-1784
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/f6bdc8e7a4d73beeec35564d861827e8b3a3c4e3

Comment by Githook User [ 30/Apr/15 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Reinstated obedient commands for DB

JAVA-1784
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/651e53b53024c8cb16599746bf7de0b8f11b19b7

Comment by Ross Lawley [ 29/Apr/15 ]

Hi dharshanr@scalegrid.net,

In 3.0.0 the db.command(cmd) uses the set read preference of the database which must not be primary in your case. I'm investigating the reasons and / or cause for the change.

In the meantime please include the read preference in your code to: db.command(cmd, ReadPreference.primary())

Generated at Thu Feb 08 08:55:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.