Hello, mongo people,
I have a question regarding mongoexport with slaveOk option.
Currently, i have a replica set with master, slave and arbiter in a shard.
my reading service is currently reading from slave with 'slaveOk' option from my driver.
But, when I tried export data based on a query with slaveOk, it seems to export from master
this mongoexport command ran on 'mongos' and, asking to export from slave since our master is busy with 'write'.
here is my shell script that runs on 'mongos':
#!/bin/bash
query=$1
fields=$2
params="-d {ourdb} -c {collection-name} -slaveOk 1 -q "$query" -f "$fields" --csv -o download/mongoexport.csv"
echo $params
mongoexport $params
As you can see in above 'red' text, I turned on slaveOk option (according mongo db doc, it's default) to make sure.
But, exported records are from master. for testing, i put slaveDelay to be one hour, and master & secondary data were not the same due to delay.
So, i export exported csv is from secondary. but, actually, data were from primary version.
Again, i am running on 'mongos'.
Is there anything I did wrong?
Thanks in advance.