But in case of sharded collections, how do you connect to the primary nodes
of all shards ??
And by the way, what is the --slaveOk option for if it is a default option
and cannot be negated ?
Le mardi 19 avril 2016 01:27:38 UTC+2, Kevin Adistambha a écrit :
How to disable this option in the mongoexport command line and export from
primaries only ?
For MongoDB version 3.2.x and above, mongoexport allows --readPreference
setting (this is shown in the contents of mongoexport --help).
However in your case (with MongoDB 3.0.5), you have to connect to the
Primary node directly by specifying the Primary’s address in the --host
parameter. You can find out which node is the current Primary by connecting
to the replica set and executing db.isMaster().primary on the mongo shell.
Please note that exporting from the Primary node may push your working set
out of memory and may degrade query performance.