Closed beanhacker closed 4 years ago
You mean you are running a standalone mongodb deployment?
Hey @Googlom,
Please take a look at this request. Making replica set optional looks like a reasonable idea to me.
Transactions don't work without replicaset configured on MongoDB. I'll have to remove transaction support to be able to run on standalone MongoDB instance. Or duplicate query logic to support both transaction and non-transaction queries - then it'll be possible to do replica set optional.
I think it's a tradeoff which the user should be able to make. We just need to make it clear to the user. Maybe even write it to the log when initalizing the adapter.
It's a actually quite easy to make transactions optional. Define something like
func (a *adapter) maybeStartTransaction(sess mdb.Session) error {
if a.useTransactions {
return sess.StartTransaction()
}
return nil
}
func (a *adapter) maybeCommitTransaction(sess mdb.Session) error {
... same as above but with sess.CommitTransaction ...
}
And then use these calls everywhere instead of sess.StartTransaction
/sess.CommitTransaction
.
@Googlom would you make the changes or should I?
I will make the changes tomorrow
Thanks!
Done in #333
Hello author, the MONOGODB I use here does not do a replication set. If I do a replication set at this time, many other services will also be forced to add the replication set option when connecting. Need to modify the system a lot. replica_set made configurable? thank!