Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Critical] fix serialization of readConcern #370

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2912,7 +2912,6 @@ func (p *Pipe) SetMaxTime(d time.Duration) *Pipe {
return p
}


// Collation allows to specify language-specific rules for string comparison,
// such as rules for lettercase and accent marks.
// When specifying collation, the locale field is mandatory; all other collation
Expand Down Expand Up @@ -3769,7 +3768,7 @@ func prepareFindOp(socket *mongoSocket, op *queryOp, limit int32) bool {
AwaitData: op.flags&flagAwaitData != 0,
OplogReplay: op.flags&flagLogReplay != 0,
NoCursorTimeout: op.flags&flagNoCursorTimeout != 0,
ReadConcern: readLevel{level: op.readConcern},
ReadConcern: readLevel{Level: op.readConcern},
}

if op.limit < 0 {
Expand All @@ -3789,6 +3788,7 @@ func prepareFindOp(socket *mongoSocket, op *queryOp, limit int32) bool {
op.hasOptions = false

if explain {
find.ReadConcern.Level = ""
op.query = bson.D{{Name: "explain", Value: op.query}}
return false
}
Expand Down Expand Up @@ -3838,7 +3838,7 @@ type findCmd struct {
// readLevel provides the nested "level: majority" serialisation needed for the
// query read concern.
type readLevel struct {
level string `bson:"level,omitempty"`
Level string `bson:"level,omitempty"`
}

// getMoreCmd holds the command used for requesting more query results on MongoDB 3.2+.
Expand Down