I’d like to know something : when we do a $in request in a replica-set environnement with slaveOkay() enabled on the driver (which is if I understood correctly basically splitting queries on the different slaves), is mongo natively splitting the $in array between slaves? Thanks by advance!
Share
I’d have to say no. For it to effectively split the $in array between slaves they’d have to be split before sending the query (the client/driver would need to change the query into multiple queries effectively) and merged them back for the full result.
With slaveOk it just routes the whole query to one member, where the first choice would be a secondary/non-primary.
If you want to (potentially) break this up across multiple servers then you could group the $in array into smaller chunks and do multiple concurrent queries.