Skip to content

Commit 87fdae9

Browse files
author
Divjot Arora
authored
GODRIVER-1378 Collection documentation (#218)
1 parent 894900d commit 87fdae9

File tree

3 files changed

+232
-55
lines changed

3 files changed

+232
-55
lines changed

mongo/client.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,15 @@ func (c *Client) Database(name string, opts ...*options.DatabaseOptions) *Databa
645645
return newDatabase(c, name, opts...)
646646
}
647647

648-
// ListDatabases performs a listDatabases operation and returns the result.
648+
// ListDatabases executes a listDatabases command and returns the result.
649649
//
650-
// The filter parameter should be a document containing query operatiors and can be used to select which
650+
// The filter parameter must be a document containing query operators and can be used to select which
651651
// databases are included in the result. It cannot be nil. An empty document (e.g. bson.D{}) should be used to include
652652
// all databases.
653653
//
654654
// The opts paramter can be used to specify options for this operation (see the options.ListDatabasesOptions documentation).
655+
//
656+
// For more information about the command, see https://docs.mongodb.com/manual/reference/command/listDatabases/.
655657
func (c *Client) ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (ListDatabasesResult, error) {
656658
if ctx == nil {
657659
ctx = context.Background()
@@ -705,12 +707,17 @@ func (c *Client) ListDatabases(ctx context.Context, filter interface{}, opts ...
705707
return newListDatabasesResultFromOperation(op.Result()), nil
706708
}
707709

708-
// ListDatabaseNames performs a listDatabases operation and returns a slice containing the names of all of the databases
710+
// ListDatabaseNames executes a listDatabases command and returns a slice containing the names of all of the databases
709711
// on the server.
710712
//
711-
// The filter parameter should be a document containing query operators and can be used to select which databases
713+
// The filter parameter must be a document containing query operators and can be used to select which databases
712714
// are included in the result. It cannot be nil. An empty document (e.g. bson.D{}) should be used to include all
713715
// databases.
716+
//
717+
// The opts parameter can be used to specify options for this operation (see the options.ListDatabasesOptions
718+
// documentation.)
719+
//
720+
// For more information about the command, see https://docs.mongodb.com/manual/reference/command/listDatabases/.
714721
func (c *Client) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error) {
715722
opts = append(opts, options.ListDatabases().SetNameOnly(true))
716723

@@ -775,15 +782,16 @@ func (c *Client) UseSessionWithOptions(ctx context.Context, opts *options.Sessio
775782
return fn(sessCtx)
776783
}
777784

778-
// Watch returns a change stream for all changes on the connected deployment. See https://docs.mongodb.com/manual/changeStreams/
779-
// for more information about change streams.
785+
// Watch returns a change stream for all changes on the deployment. See
786+
// https://docs.mongodb.com/manual/changeStreams/ for more information about change streams.
780787
//
781788
// The client must be configured with read concern majority or no read concern for a change stream to be created
782789
// successfully.
783790
//
784-
// The pipeline parameter should be an array of documents, each representing a pipeline stage. See
785-
// https://docs.mongodb.com/manual/changeStreams/ for a list of pipeline stages that can be used with change streams.
786-
// For a pipeline of bson.D documents, the mongo.Pipeline{} type can be used.
791+
// The pipeline parameter must be an array of documents, each representing a pipeline stage. The pipeline cannot be
792+
// nil or empty. The stage documents must all be non-nil. See https://docs.mongodb.com/manual/changeStreams/ for a list
793+
// of pipeline stages that can be used with change streams. For a pipeline of bson.D documents, the mongo.Pipeline{}
794+
// type can be used.
787795
//
788796
// The opts parameter can be used to specify options for change stream creation (see the options.ChangeStreamOptions
789797
// documentation).

0 commit comments

Comments
 (0)