-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 0.0.1
-
Component/s: Options & Configuration
As we discussed the options for the mongo package should be implemented as a type with a method for each option that's available. For instance:
type CountOptions struct{
opt options.Option
err error
}
func (co CountOptions) Limit(int) CountOptions
func (co CountOptions) MaxTime(time.Duration) CountOptions
...
Each method should return the type.
Ideally this should be implemented as a stack (see the way context.Context is implemented), this way the same base CountOptions can be attached to the mongo.Opt variable and the Options type can simply use a single copy of each type. There should be an error for each type, and either the option or the error should be set.
Each Collection method should take a single *Options stack. Upon seeing the first error, it should return that error to the user. The methods should unwind the options into a slice and pass that slice to the commands.
- causes
-
GODRIVER-302 Optioner Interfaces are difficult to construct programatically
- Closed
- depends on
-
GODRIVER-444 Design : Options Management
- Closed
- is depended on by
-
GODRIVER-266 Properly implement maxAwaitTimeMS
- Closed
-
GODRIVER-335 Split options.OptProjection into OptFields and OptProjection
- Closed
-
GODRIVER-50 Support maxTimeMS for createIndexes and dropIndexes commands
- Closed
-
GODRIVER-349 Separate cursor options from other options in commands
- Closed
-
GODRIVER-350 Change OptWriteConcern to directly wrap a writeconcern.WriteConcern
- Closed
- related to
-
GODRIVER-337 Allow option.Optioner to return an error
- Closed