Documentation ¶
Index ¶
- func AggregationExamples(t *testing.T, db *mongo.Database)
- func CausalConsistencyExamples(client *mongo.Client) error
- func ChangeStreamExamples(t *testing.T, db *mongo.Database)
- func CommitWithRetry(sctx mongo.SessionContext) error
- func DeleteExamples(t *testing.T, db *mongo.Database)
- func IndexExamples(t *testing.T, db *mongo.Database)
- func InsertExamples(t *testing.T, db *mongo.Database)
- func ProjectionExamples(t *testing.T, db *mongo.Database)
- func QueryArrayEmbeddedDocumentsExamples(t *testing.T, db *mongo.Database)
- func QueryArraysExamples(t *testing.T, db *mongo.Database)
- func QueryEmbeddedDocumentsExamples(t *testing.T, db *mongo.Database)
- func QueryNullMissingFieldsExamples(t *testing.T, db *mongo.Database)
- func QueryToplevelFieldsExamples(t *testing.T, db *mongo.Database)
- func RunCommandExamples(t *testing.T, db *mongo.Database)
- func RunTransactionWithRetry(sctx mongo.SessionContext, txnFn func(mongo.SessionContext) error) error
- func SnapshotQueryExamples(mt *mtest.T)
- func StableAPIDeprecationErrorsExample()
- func StableAPIExample()
- func StableAPIExamples()
- func StableAPINonStrictExample()
- func StableAPIStrictCountExample(t *testing.T)
- func StableAPIStrictExample()
- func TransactionsExamples(ctx context.Context, client *mongo.Client) error
- func UpdateEmployeeInfo(ctx context.Context, client *mongo.Client) error
- func UpdateExamples(t *testing.T, db *mongo.Database)
- func WithTransactionExample(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregationExamples ¶ added in v1.5.0
AggregationExamples contains examples of aggregation operations. Appears at https://www.mongodb.com/docs/manual/aggregation/.
func CausalConsistencyExamples ¶ added in v1.8.0
CausalConsistencyExamples contains examples of causal consistency usage. Appears at https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency/.
func ChangeStreamExamples ¶ added in v1.0.0
ChangeStreamExamples contains examples of changestream operations. Appears at https://www.mongodb.com/docs/manual/changeStreams/.
func CommitWithRetry ¶ added in v1.0.0
func CommitWithRetry(sctx mongo.SessionContext) error
CommitWithRetry is an example function demonstrating transaction commit with retry logic.
func DeleteExamples ¶
DeleteExamples contains examples of delete operations. Appears at https://www.mongodb.com/docs/manual/tutorial/remove-documents/.
func IndexExamples ¶ added in v1.5.0
IndexExamples contains examples of Index operations. Appears at https://www.mongodb.com/docs/manual/indexes/.
func InsertExamples ¶
InsertExamples contains examples for insert operations. Appears at https://www.mongodb.com/docs/manual/tutorial/insert-documents/.
func ProjectionExamples ¶
ProjectionExamples contains examples for specifying projections in find operations. Appears at https://www.mongodb.com/docs/manual/tutorial/project-fields-from-query-results/.
func QueryArrayEmbeddedDocumentsExamples ¶
QueryArrayEmbeddedDocumentsExamples contains examples for querying fields with arrays and embedded documents. Appears at https://www.mongodb.com/docs/manual/tutorial/query-array-of-documents/.
func QueryArraysExamples ¶
QueryArraysExamples contains examples for querying array fields. Appears at https://www.mongodb.com/docs/manual/tutorial/query-arrays/.
func QueryEmbeddedDocumentsExamples ¶
QueryEmbeddedDocumentsExamples contains examples for querying embedded document fields. Appears at https://www.mongodb.com/docs/manual/tutorial/query-embedded-documents/.
func QueryNullMissingFieldsExamples ¶
QueryNullMissingFieldsExamples contains examples for querying fields that are null or missing. Appears at https://www.mongodb.com/docs/manual/tutorial/query-for-null-fields/.
func QueryToplevelFieldsExamples ¶
QueryToplevelFieldsExamples contains examples for querying top-level fields. Appears at https://www.mongodb.com/docs/manual/tutorial/query-documents/.
func RunCommandExamples ¶ added in v1.5.0
RunCommandExamples contains examples of RunCommand operations. Appears at https://www.mongodb.com/docs/manual/reference/command/buildInfo/.
func RunTransactionWithRetry ¶ added in v1.0.0
func RunTransactionWithRetry(sctx mongo.SessionContext, txnFn func(mongo.SessionContext) error) error
RunTransactionWithRetry is an example function demonstrating transaction retry logic.
func SnapshotQueryExamples ¶ added in v1.9.0
SnapshotQuery examples runs examples of using sessions with Snapshot enabled. These appear at https://www.mongodb.com/docs/manual/tutorial/long-running-queries/.
func StableAPIDeprecationErrorsExample ¶ added in v1.9.0
func StableAPIDeprecationErrorsExample()
StableAPIDeprecationErrorsExample is an example of creating a client with stable API with deprecation errors.
func StableAPIExample ¶ added in v1.9.0
func StableAPIExample()
StableAPIExample is an example of creating a client with stable API.
func StableAPIExamples ¶ added in v1.9.0
func StableAPIExamples()
StableAPIExamples runs all stable API examples. These appear at https://www.mongodb.com/docs/manual/reference/stable-api/.
func StableAPINonStrictExample ¶ added in v1.9.0
func StableAPINonStrictExample()
StableAPINonStrictExample is an example of creating a client with non-strict stable API.
func StableAPIStrictCountExample ¶ added in v1.9.0
StableAPIStrictCountExample is an example of using CountDocuments instead of a traditional count with a strict stable API since the count command does not belong to API version 1.
func StableAPIStrictExample ¶ added in v1.9.0
func StableAPIStrictExample()
StableAPIStrictExample is an example of creating a client with strict stable API.
func TransactionsExamples ¶ added in v1.0.0
TransactionsExamples contains examples for transaction operations.
func UpdateEmployeeInfo ¶ added in v1.0.0
UpdateEmployeeInfo is an example function demonstrating transactions.
func UpdateExamples ¶
UpdateExamples contains examples of update operations. Appears at https://www.mongodb.com/docs/manual/tutorial/update-documents/.
func WithTransactionExample ¶ added in v1.4.0
WithTransactionExample is an example of using the Session.WithTransaction function.
Types ¶
This section is empty.