c# - Can creating indexes on MongoDB collections in a replica set be done programmatically? -
i've seen instructions creating indexes on replica sets in mongodb here. looks involved , requires mongo shell. there easier way and/or can done using c# mongodb driver?
as can see in docs, there 4 possible stages both primaries , secondaries:
- build index in background on primary.
- build index
- stop 1 secondary
- restart program mongod
the first 2 can using driver, because mongod
up. use ensureindex
right parameters.
for next 2 can't use driver can still programmatically in command prompt:
var stop = process.start("mongod", "--shutdown"); var standalone = process.start("mongod", "--port 47017"); var replicated = process.start("mongod", "--port 27017 --replset rs0");
Comments
Post a Comment