diff --git a/mongo/database.go b/mongo/database.go index f5d5ad379b..6760f0d014 100644 --- a/mongo/database.go +++ b/mongo/database.go @@ -185,18 +185,21 @@ func (db *Database) processRunCommand(ctx context.Context, cmd interface{}, op = operation.NewCommand(runCmdDoc) } - // TODO(GODRIVER-2649): ReadConcern(db.readConcern) will not actually pass the database's - // read concern. Remove this note once readConcern is correctly passed to the operation - // level. return op.Session(sess).CommandMonitor(db.client.monitor). ServerSelector(readSelect).ClusterClock(db.client.clock). - Database(db.name).Deployment(db.client.deployment).ReadConcern(db.readConcern). + Database(db.name).Deployment(db.client.deployment). Crypt(db.client.cryptFLE).ReadPreference(ro.ReadPreference).ServerAPI(db.client.serverAPI). Timeout(db.client.timeout).Logger(db.client.logger), sess, nil } -// RunCommand executes the given command against the database. This function does not obey the Database's read -// preference. To specify a read preference, the RunCmdOptions.ReadPreference option must be used. +// RunCommand executes the given command against the database. +// +// This function does not obey the Database's readPreference. To specify a read +// preference, the RunCmdOptions.ReadPreference option must be used. +// +// This function does not obey the Database's readConcern or writeConcern. A +// user must supply these values manually in the user-provided runCommand +// parameter. // // The runCommand parameter must be a document for the command to be executed. It cannot be nil. // This must be an order-preserving type such as bson.D. Map types such as bson.M are not valid. diff --git a/x/mongo/driver/operation/command.go b/x/mongo/driver/operation/command.go index 5aad3f72e6..35283794a3 100644 --- a/x/mongo/driver/operation/command.go +++ b/x/mongo/driver/operation/command.go @@ -14,7 +14,6 @@ import ( "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/internal/logger" "go.mongodb.org/mongo-driver/mongo/description" - "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver" @@ -24,7 +23,6 @@ import ( // Command is used to run a generic operation. type Command struct { command bsoncore.Document - readConcern *readconcern.ReadConcern database string deployment driver.Deployment selector description.ServerSelector @@ -79,7 +77,6 @@ func (c *Command) Execute(ctx context.Context) error { return errors.New("the Command operation must have a Deployment set before Execute can be called") } - // TODO(GODRIVER-2649): Actually pass readConcern to underlying driver.Operation. return driver.Operation{ CommandFn: func(dst []byte, desc description.SelectedServer) ([]byte, error) { return append(dst, c.command[4:len(c.command)-1]...), nil @@ -163,16 +160,6 @@ func (c *Command) Deployment(deployment driver.Deployment) *Command { return c } -// ReadConcern specifies the read concern for this operation. -func (c *Command) ReadConcern(readConcern *readconcern.ReadConcern) *Command { - if c == nil { - c = new(Command) - } - - c.readConcern = readConcern - return c -} - // ReadPreference set the read preference used with this operation. func (c *Command) ReadPreference(readPreference *readpref.ReadPref) *Command { if c == nil {