Details
-
New Feature
-
Resolution: Unresolved
-
Minor - P4
-
None
-
1.5.1, 1.5.2, 1.5.3
-
go1.16.4
windows
linux
Description
From my understanding of reading the Go driver code documentation and mongo docs client drivers should, by default, be set to use causal consistency:
![]()
I've noticed in the Go(lang) driver, when creating a new client or creating a new session, both read concern and write concern are set to empty, but CausalConsistency/Consistent is set to true by default.
According to the go driver docs:

New Client:
![]()
New Session:
![]()
![]()
The `session.ClientSession.Consistent` property by default is set to true.
So should the driver by default, be setting the "best practice" causal consistency preferences?
OR when calling `client.StartSession(options.Session().SetCausalConsistency(true))` should this be setting default majority read and write concerns?
Current implementation of `mongo/options/sessionoptions.go#ln51`
// SetCausalConsistency sets the value for the CausalConsistency field.
|
func (s *SessionOptions) SetCausalConsistency(b bool) *SessionOptions {
|
s.CausalConsistency = &b
|
return s |
}
|
Suggested Implementation?
// SetCausalConsistency sets the value for the CausalConsistency field.
|
func (s *SessionOptions) SetCausalConsistency(b bool) *SessionOptions {
|
s.CausalConsistency = &b
|
s.DefaultReadConcern = readconcern.Majority()
|
s.DefaultWriteConcern = writeconcern.New(writeconcern.WMajority())
|
return s |
}
|
Attachments
Issue Links
- related to
-
DRIVERS-1798 Add read/write concern options on a session
-
- Backlog
-