Skip to content

Commit 66dad3a

Browse files
authored
GODRIVER-2247 Add missing comments to exported functions/types (#823)
1 parent 2bc145d commit 66dad3a

File tree

14 files changed

+36
-20
lines changed

14 files changed

+36
-20
lines changed

bson/marshal.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,13 @@ func MarshalExtJSONAppendWithContext(ec bsoncodec.EncodeContext, dst []byte, val
225225
return *sw, nil
226226
}
227227

228+
// IndentExtJSON will prefix and indent the provided extended JSON src and append it to dst.
228229
func IndentExtJSON(dst *bytes.Buffer, src []byte, prefix, indent string) error {
229230
return json.Indent(dst, src, prefix, indent)
230231
}
231232

233+
// MarshalExtJSONIndent returns the extended JSON encoding of val with each line with prefixed
234+
// and indented.
232235
func MarshalExtJSONIndent(val interface{}, canonical, escapeHTML bool, prefix, indent string) ([]byte, error) {
233236
marshaled, err := MarshalExtJSON(val, canonical, escapeHTML)
234237
if err != nil {

x/mongo/driver/operation/aggregate.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"go.mongodb.org/mongo-driver/x/mongo/driver/session"
2222
)
2323

24-
// Performs an aggregate operation
24+
// Aggregate represents an aggregate operation.
2525
type Aggregate struct {
2626
allowDiskUse *bool
2727
batchSize *int32
@@ -67,6 +67,8 @@ func (a *Aggregate) Result(opts driver.CursorOptions) (*driver.BatchCursor, erro
6767
return driver.NewBatchCursor(a.result, clientSession, clock, opts)
6868
}
6969

70+
// ResultCursorResponse returns the underlying CursorResponse result of executing this
71+
// operation.
7072
func (a *Aggregate) ResultCursorResponse() driver.CursorResponse {
7173
return a.result
7274
}

x/mongo/driver/operation/count.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"go.mongodb.org/mongo-driver/x/mongo/driver/session"
2121
)
2222

23-
// Performs a count operation
23+
// Count represents a count operation.
2424
type Count struct {
2525
maxTimeMS *int64
2626
query bsoncore.Document
@@ -39,6 +39,7 @@ type Count struct {
3939
serverAPI *driver.ServerAPIOptions
4040
}
4141

42+
// CountResult represents a count result returned by the server.
4243
type CountResult struct {
4344
// The number of documents found
4445
N int64

x/mongo/driver/operation/create.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"go.mongodb.org/mongo-driver/x/mongo/driver/session"
1919
)
2020

21-
// Create a create operation
21+
// Create represents a create operation.
2222
type Create struct {
2323
capped *bool
2424
collation bsoncore.Document
@@ -127,7 +127,7 @@ func (c *Create) command(dst []byte, desc description.SelectedServer) ([]byte, e
127127
return dst, nil
128128
}
129129

130-
// Specifies if the collection is capped.
130+
// Capped specifies if the collection is capped.
131131
func (c *Create) Capped(capped bool) *Create {
132132
if c == nil {
133133
c = new(Create)
@@ -147,7 +147,7 @@ func (c *Create) Collation(collation bsoncore.Document) *Create {
147147
return c
148148
}
149149

150-
// Specifies the name of the collection to create.
150+
// CollectionName specifies the name of the collection to create.
151151
func (c *Create) CollectionName(collectionName string) *Create {
152152
if c == nil {
153153
c = new(Create)
@@ -157,7 +157,7 @@ func (c *Create) CollectionName(collectionName string) *Create {
157157
return c
158158
}
159159

160-
// Specifies a default configuration for indexes on the collection.
160+
// IndexOptionDefaults specifies a default configuration for indexes on the collection.
161161
func (c *Create) IndexOptionDefaults(indexOptionDefaults bsoncore.Document) *Create {
162162
if c == nil {
163163
c = new(Create)
@@ -167,7 +167,7 @@ func (c *Create) IndexOptionDefaults(indexOptionDefaults bsoncore.Document) *Cre
167167
return c
168168
}
169169

170-
// Specifies the maximum number of documents allowed in a capped collection.
170+
// Max specifies the maximum number of documents allowed in a capped collection.
171171
func (c *Create) Max(max int64) *Create {
172172
if c == nil {
173173
c = new(Create)
@@ -177,7 +177,7 @@ func (c *Create) Max(max int64) *Create {
177177
return c
178178
}
179179

180-
// Specifies the agggregtion pipeline to be run against the source to create the view.
180+
// Pipeline specifies the agggregtion pipeline to be run against the source to create the view.
181181
func (c *Create) Pipeline(pipeline bsoncore.Document) *Create {
182182
if c == nil {
183183
c = new(Create)
@@ -187,7 +187,7 @@ func (c *Create) Pipeline(pipeline bsoncore.Document) *Create {
187187
return c
188188
}
189189

190-
// Specifies the maximum size in bytes for a capped collection.
190+
// Size specifies the maximum size in bytes for a capped collection.
191191
func (c *Create) Size(size int64) *Create {
192192
if c == nil {
193193
c = new(Create)
@@ -197,7 +197,7 @@ func (c *Create) Size(size int64) *Create {
197197
return c
198198
}
199199

200-
// Specifies the storage engine to use for the index.
200+
// StorageEngine specifies the storage engine to use for the index.
201201
func (c *Create) StorageEngine(storageEngine bsoncore.Document) *Create {
202202
if c == nil {
203203
c = new(Create)
@@ -207,7 +207,7 @@ func (c *Create) StorageEngine(storageEngine bsoncore.Document) *Create {
207207
return c
208208
}
209209

210-
// Specifies what should happen if a document being inserted does not pass validation.
210+
// ValidationAction specifies what should happen if a document being inserted does not pass validation.
211211
func (c *Create) ValidationAction(validationAction string) *Create {
212212
if c == nil {
213213
c = new(Create)
@@ -217,7 +217,8 @@ func (c *Create) ValidationAction(validationAction string) *Create {
217217
return c
218218
}
219219

220-
// Specifies how strictly the server applies validation rules to existing documents in the collection during update operations.
220+
// ValidationLevel specifies how strictly the server applies validation rules to existing documents in the collection
221+
// during update operations.
221222
func (c *Create) ValidationLevel(validationLevel string) *Create {
222223
if c == nil {
223224
c = new(Create)
@@ -227,7 +228,7 @@ func (c *Create) ValidationLevel(validationLevel string) *Create {
227228
return c
228229
}
229230

230-
// Specifies validation rules for the collection.
231+
// Validator specifies validation rules for the collection.
231232
func (c *Create) Validator(validator bsoncore.Document) *Create {
232233
if c == nil {
233234
c = new(Create)
@@ -237,7 +238,7 @@ func (c *Create) Validator(validator bsoncore.Document) *Create {
237238
return c
238239
}
239240

240-
// Specifies the name of the source collection or view on which the view will be created.
241+
// ViewOn specifies the name of the source collection or view on which the view will be created.
241242
func (c *Create) ViewOn(viewOn string) *Create {
242243
if c == nil {
243244
c = new(Create)

x/mongo/driver/operation/createIndexes.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type CreateIndexes struct {
3838
serverAPI *driver.ServerAPIOptions
3939
}
4040

41+
// CreateIndexesResult represents a createIndexes result returned by the server.
4142
type CreateIndexesResult struct {
4243
// If the collection was created automatically.
4344
CreatedCollectionAutomatically bool
@@ -133,9 +134,9 @@ func (ci *CreateIndexes) command(dst []byte, desc description.SelectedServer) ([
133134
return dst, nil
134135
}
135136

136-
// The number of data-bearing members of a replica set, including the primary, that must complete the index builds
137-
// successfully before the primary marks the indexes as ready. This should either be a string or int32 value.
138-
//
137+
// CommitQuorum specifies the number of data-bearing members of a replica set, including the primary, that must
138+
// complete the index builds successfully before the primary marks the indexes as ready. This should either be a
139+
// string or int32 value.
139140
func (ci *CreateIndexes) CommitQuorum(commitQuorum bsoncore.Value) *CreateIndexes {
140141
if ci == nil {
141142
ci = new(CreateIndexes)
@@ -145,7 +146,7 @@ func (ci *CreateIndexes) CommitQuorum(commitQuorum bsoncore.Value) *CreateIndexe
145146
return ci
146147
}
147148

148-
// An array containing index specification documents for the indexes being created.
149+
// Indexes specifies an array containing index specification documents for the indexes being created.
149150
func (ci *CreateIndexes) Indexes(indexes bsoncore.Document) *CreateIndexes {
150151
if ci == nil {
151152
ci = new(CreateIndexes)

x/mongo/driver/operation/delete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Delete struct {
3838
serverAPI *driver.ServerAPIOptions
3939
}
4040

41+
// DeleteResult represents a delete result returned by the server.
4142
type DeleteResult struct {
4243
// Number of documents successfully deleted.
4344
N int32

x/mongo/driver/operation/distinct.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type Distinct struct {
4040
serverAPI *driver.ServerAPIOptions
4141
}
4242

43+
// DistinctResult represents a distinct result returned by the server.
4344
type DistinctResult struct {
4445
// The distinct values for the field.
4546
Values bsoncore.Value

x/mongo/driver/operation/drop_collection.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type DropCollection struct {
3434
serverAPI *driver.ServerAPIOptions
3535
}
3636

37+
// DropCollectionResult represents a dropCollection result returned by the server.
3738
type DropCollectionResult struct {
3839
// The number of indexes in the dropped collection.
3940
NIndexesWas int32

x/mongo/driver/operation/drop_indexes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type DropIndexes struct {
3636
serverAPI *driver.ServerAPIOptions
3737
}
3838

39+
// DropIndexesResult represents a dropIndexes result returned by the server.
3940
type DropIndexesResult struct {
4041
// Number of indexes that existed before the drop was executed.
4142
NIndexesWas int32

x/mongo/driver/operation/end_sessions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (es *EndSessions) command(dst []byte, desc description.SelectedServer) ([]b
7070
return dst, nil
7171
}
7272

73-
// sessionIDs specify the sessions to be expired.
73+
// SessionIDs specifies the sessions to be expired.
7474
func (es *EndSessions) SessionIDs(sessionIDs bsoncore.Document) *EndSessions {
7575
if es == nil {
7676
es = new(EndSessions)

x/mongo/driver/operation/find.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (f *Find) OplogReplay(oplogReplay bool) *Find {
321321
return f
322322
}
323323

324-
// Project limits the fields returned for all documents.
324+
// Projection limits the fields returned for all documents.
325325
func (f *Find) Projection(projection bsoncore.Document) *Find {
326326
if f == nil {
327327
f = new(Find)

x/mongo/driver/operation/find_and_modify.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ type FindAndModify struct {
5050
result FindAndModifyResult
5151
}
5252

53+
// LastErrorObject represents information about updates and upserts returned by the server.
5354
type LastErrorObject struct {
5455
// True if an update modified an existing document
5556
UpdatedExisting bool
5657
// Object ID of the upserted document.
5758
Upserted interface{}
5859
}
5960

61+
// FindAndModifyResult represents a findAndModify result returned by the server.
6062
type FindAndModifyResult struct {
6163
// Either the old or modified document, depending on the value of the new parameter.
6264
Value bsoncore.Document

x/mongo/driver/operation/insert.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Insert struct {
3838
serverAPI *driver.ServerAPIOptions
3939
}
4040

41+
// InsertResult represents an insert result returned by the server.
4142
type InsertResult struct {
4243
// Number of documents successfully inserted.
4344
N int32

x/mongo/driver/operation/listDatabases.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type ListDatabases struct {
3939
result ListDatabasesResult
4040
}
4141

42+
// ListDatabasesResult represents a listDatabases result returned by the server.
4243
type ListDatabasesResult struct {
4344
// An array of documents, one document for each database
4445
Databases []databaseRecord

0 commit comments

Comments
 (0)