[JAVA-754] Why Java Driver does not allow to execute saved javascript on secondary node Created: 07/Feb/13  Updated: 11/Sep/19  Resolved: 10/Mar/13

Status: Closed
Project: Java Driver
Component/s: Connection Management
Affects Version/s: 2.10.1
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Michele Sonnessa Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When the ReadPreference.secondary() is set and command is executed,
DB class force the driver to ReadPreference.primary()

I worder why this behaviour has been introduced.

I need to invoke javascript functions and spread the call over
my replica set.

Is there a workaround?



 Comments   
Comment by Scott Hernandez (Inactive) [ 10/Mar/13 ]

Michele, this is not something the driver/client can do since the server doesn't allow executing javascript via $eval/db.eval() on anything but the primary node in a replica set. This is a server limitation not a client one.

Please create a server issue if you wish to suggest this feature: http://jira.mongodb.org/browse/server

Comment by Jeffrey Yemin [ 09/Mar/13 ]

scotthernandez ping

Comment by Michele Sonnessa [ 08/Feb/13 ]

Thanks.

It's not clear the reason, especially if I use

{nolock: true}

I'm going to execute some computation stuff without writing data. Why I cannot
take advantage of distributed computation?

Comment by Jeffrey Yemin [ 08/Feb/13 ]

The eval command will only run on the primary, which is why we force eval to the primary instead of obeying read preference.

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