You are browsing a version that is no longer maintained. |
Slave Okay Queries
Documents
You can configure an entire document to send all reads to the slaves by using the slaveOkay
flag:
Now all reads involving the User
document will be sent to a slave.
Queries
If you want to instruct individual queries to read from a slave you can use the slaveOkay()
method
on the query builder.
The data in the query above will be read from a slave. Even if you have a @ReferenceOne
or
@ReferenceMany
resulting from the query above it will be initialized and loaded from a slave.
Now when you query and iterate over the accounts, they will be loaded from a slave: