Skip to content

Commit d52c9e1

Browse files
GODRIVER-2649 Remove RW Concern Logic from RunCommand (#1450)
1 parent 17f9d77 commit d52c9e1

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

mongo/database.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,21 @@ func (db *Database) processRunCommand(ctx context.Context, cmd interface{},
185185
op = operation.NewCommand(runCmdDoc)
186186
}
187187

188-
// TODO(GODRIVER-2649): ReadConcern(db.readConcern) will not actually pass the database's
189-
// read concern. Remove this note once readConcern is correctly passed to the operation
190-
// level.
191188
return op.Session(sess).CommandMonitor(db.client.monitor).
192189
ServerSelector(readSelect).ClusterClock(db.client.clock).
193-
Database(db.name).Deployment(db.client.deployment).ReadConcern(db.readConcern).
190+
Database(db.name).Deployment(db.client.deployment).
194191
Crypt(db.client.cryptFLE).ReadPreference(ro.ReadPreference).ServerAPI(db.client.serverAPI).
195192
Timeout(db.client.timeout).Logger(db.client.logger), sess, nil
196193
}
197194

198-
// RunCommand executes the given command against the database. This function does not obey the Database's read
199-
// preference. To specify a read preference, the RunCmdOptions.ReadPreference option must be used.
195+
// RunCommand executes the given command against the database.
196+
//
197+
// This function does not obey the Database's readPreference. To specify a read
198+
// preference, the RunCmdOptions.ReadPreference option must be used.
199+
//
200+
// This function does not obey the Database's readConcern or writeConcern. A
201+
// user must supply these values manually in the user-provided runCommand
202+
// parameter.
200203
//
201204
// The runCommand parameter must be a document for the command to be executed. It cannot be nil.
202205
// This must be an order-preserving type such as bson.D. Map types such as bson.M are not valid.

x/mongo/driver/operation/command.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"go.mongodb.org/mongo-driver/event"
1515
"go.mongodb.org/mongo-driver/internal/logger"
1616
"go.mongodb.org/mongo-driver/mongo/description"
17-
"go.mongodb.org/mongo-driver/mongo/readconcern"
1817
"go.mongodb.org/mongo-driver/mongo/readpref"
1918
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
2019
"go.mongodb.org/mongo-driver/x/mongo/driver"
@@ -24,7 +23,6 @@ import (
2423
// Command is used to run a generic operation.
2524
type Command struct {
2625
command bsoncore.Document
27-
readConcern *readconcern.ReadConcern
2826
database string
2927
deployment driver.Deployment
3028
selector description.ServerSelector
@@ -79,7 +77,6 @@ func (c *Command) Execute(ctx context.Context) error {
7977
return errors.New("the Command operation must have a Deployment set before Execute can be called")
8078
}
8179

82-
// TODO(GODRIVER-2649): Actually pass readConcern to underlying driver.Operation.
8380
return driver.Operation{
8481
CommandFn: func(dst []byte, desc description.SelectedServer) ([]byte, error) {
8582
return append(dst, c.command[4:len(c.command)-1]...), nil
@@ -163,16 +160,6 @@ func (c *Command) Deployment(deployment driver.Deployment) *Command {
163160
return c
164161
}
165162

166-
// ReadConcern specifies the read concern for this operation.
167-
func (c *Command) ReadConcern(readConcern *readconcern.ReadConcern) *Command {
168-
if c == nil {
169-
c = new(Command)
170-
}
171-
172-
c.readConcern = readConcern
173-
return c
174-
}
175-
176163
// ReadPreference set the read preference used with this operation.
177164
func (c *Command) ReadPreference(readPreference *readpref.ReadPref) *Command {
178165
if c == nil {

0 commit comments

Comments
 (0)