[JAVA-1301] Question about DB.setReadOnly Created: 01/Jul/14 Updated: 11/Sep/19 Resolved: 31/Jul/14 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Write Operations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Trivial - P5 |
| Reporter: | Sumit Gupta | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Description |
|
we used the now deprecated setReadOnly API to ensure that some processes don't have write access to certain DBs in a replica set. These processes can transition from a state of having write access to a state with read-only access without having to reconnect to mongo, which is something the above API provided us with. Now that the API got deprecated in 2.12.2 I seem to be unable to find a proper alternative |
| Comments |
| Comment by Jeffrey Yemin [ 31/Jul/14 ] |
|
I'm going to close this, but please feel free to comment further if you have additional questions. |
| Comment by Jeffrey Yemin [ 01/Jul/14 ] |
|
Hi Sumit, There is no alternative, and furthermore setReadOnly has never been implemented correctly. Looking at the code, the only operations that it prevents are ensureIndex and save, and even worse, the operations just fail silently without throwing an exception. I would suggest that instead of relying on the driver for this, you put in place a guard in your application code to toggle write access to different databases. |