[GODRIVER-272] Implement redesigned options for the Collection methods Created: 05/Mar/18  Updated: 28/Oct/23  Resolved: 29/Jun/18

Status: Closed
Project: Go Driver
Component/s: Options & Configuration
Affects Version/s: 0.0.1
Fix Version/s: 0.0.9

Type: Improvement Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Roland Fong
Resolution: Fixed Votes: 0
Labels: Stitch, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on GODRIVER-444 Design : Options Management Closed
is depended on by GODRIVER-266 Properly implement maxAwaitTimeMS Closed
is depended on by GODRIVER-335 Split options.OptProjection into OptF... Closed
is depended on by GODRIVER-50 Support maxTimeMS for createIndexes a... Closed
is depended on by GODRIVER-349 Separate cursor options from other op... Closed
is depended on by GODRIVER-350 Change OptWriteConcern to directly wr... Closed
Problem/Incident
causes GODRIVER-302 Optioner Interfaces are difficult to ... Closed
Related
related to GODRIVER-337 Allow option.Optioner to return an error Closed
Epic Link: Options Management

 Description   

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.



 Comments   
Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'skriptble', 'name': 'Kris Brandow', 'email': 'kris@mongodb.com'}

Message: Merge branch 'pr/74'

GODRIVER-157
GODRIVER-272
GODRIVER-335
GODRIVER-356
GODRIVER-350
GODRIVER-450

Change-Id: I713dc0fba4bbdee2445349262ea653d101e1299c
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/5fea1444e52844a15513c0d9490327b2bd89ed7c

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/runcmdopt

GODRIVER-272

Change-Id: Idd6ef1f97c55e0b4f270c42695c1cebb93a401a1
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/882b279aa53096a0ddadfa4b9c3ca6af356d06af

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/changestreamopt

GODRIVER-272

Change-Id: I8dffbf535f7756dd18980bcc3bf4f4e2d28092fc
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c9fe82492bf1215ac26c60381a859b5679c152a3

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Rename ConvertOption methods

GODRIVER-272

Change-Id: Ia519189379e17eb224c040d2ffb8ccd4ea6f4170
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/5d57f17fb29759fd6d1754d39d5f5563fb8bfc0e

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/mongoopt

GODRIVER-272

Change-Id: Ic859a6f885a40991616fccebec0f925fa667037a
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/a68198b97d1011c26b71807db2c4150a1bdf4856

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/dbopt

GODRIVER-272

Change-Id: Ie3af88a02a1bf64ab0a07a5a74438215382cdf1e
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/813c3680b9760621d912a72f013fb0ce70ee7aff

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Add mongo/collectionopt

GODRIVER-272

Change-Id: I801d503bdb6452de4b4537cbca32b7fb79f88a80
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/b5643d5b387eac3573b825fb865f6a2821df73bd

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Add mongo/clientopt

GODRIVER-272
GODRIVER-450

Change-Id: I90ca993fc7605b71a4b32283694af68a68a9279d
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c6a8120f32dc9d78b0c35099fd70624bb3b0f537

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/deleteopt

GODRIVER-272

Change-Id: I288c7632ae66e39998ebcc68eb958ba8a0ec23c8
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/6c086d66a1abdf61e531f3768e9ab572df32e4b7

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/indexopt

GODRIVER-272

Change-Id: Ia89317ff936988515f6591bbda80dbd4707992e5
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/7b2e076d7e4d663448cdbe7ca1f723e2602587d3

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/distinctopt

GODRIVER-272

Change-Id: Ic909c0e9930e822699540ca14d1bd5ba0b6b5bc7
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/d1c02c98f987971a8da405104f6b976bbe404a7d

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/countopt

GODRIVER-272

Change-Id: Iee3633f16e540fd0a97260ada6575dc47c0049b4
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c8eae34356b0ef6e3a900b7096c415991fb57c03

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Add mongo/replaceopt

GODRIVER-272

Change-Id: Ifed06e1f8ede8e292e431200360a79fed2ae26d3
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/2365c36fa036333dc83b90386296092bebc0e182

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Add mongo/insertopt

GODRIVER-272

Change-Id: If3308cd368fd3e9d7cf412a47de3440a8a883236
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/3660569286b82ea0729a892dd40ce1cd110e8bca

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Add mongo/updateopt

GODRIVER-272

Change-Id: Ia663dfa242af5073aa774d1d25b7fb3c2f1ad3ff
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/cbef64e6869ad54fbc4fe37736f19b554d186e32

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/findopt

GODRIVER-272

Change-Id: I6acc5c25b3ffeb1accfe8d14e7125c46d35792c5
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/1e1fd1052f115cc1d8c636f4aa2363c861e2fa1d

Comment by Githook User [ 29/Jun/18 ]

Author:

{'username': 'rfblue2', 'name': 'Roland Fong', 'email': 'rfblue2@gmail.com'}

Message: Allow passing aggregateopt to Aggregate

GODRIVER-272

Change-Id: Iec3a4446f5e6624510ddd1e75f498c2a64e5d929
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/b986070bfe026c994c511cba5579c1c20523ec35

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add mongo/aggregateopt

GODRIVER-272

Change-Id: I8101516ee7506501a2f5de2f7a634d33321b22c8
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/7c88c5c6b164bc5b671b1c337dd479b20ad4b911

Comment by Githook User [ 29/Jun/18 ]

Author:

{'name': 'Divjot Arora', 'email': 'divjot.arora@10gen.com'}

Message: Add String method to all options in core.

GODRIVER-272

Change-Id: I835d47ce001034df2ae927fc8a6ec33c1f954f51
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/c6a2b29899b1b8c15cbf25ccac4c20e8452e2826

Comment by Kristofer Brandow (Inactive) [ 23/May/18 ]

Design: https://github.com/mongodb/mongo-go-driver/blob/design/options-design/DESIGN.md

Generated at Thu Feb 08 08:33:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.