# README
Go Driver Documentation Examples
examples.go contains numerous documentation examples that are rendered in various locations on www.mongodb.com/docs. Each example is delineated with starting and ending comments (// Start/End Example #). All examples in examples.go are valid Go driver code. Each example is run as part of our CI with examples_test.go, so all code is up-to-date and accurate. We recommend using www.mongodb.com/docs to interact with these examples rather than viewing these files directly.
# Functions
AggregationExamples contains examples of aggregation operations.
CausalConsistencyExamples contains examples of causal consistency usage.
ChangeStreamExamples contains examples of changestream operations.
CommitWithRetry is an example function demonstrating transaction commit with retry logic.
DeleteExamples contains examples of delete operations.
IndexExamples contains examples of Index operations.
InsertExamples contains examples for insert operations.
ProjectionExamples contains examples for specifying projections in find operations.
QueryArrayEmbeddedDocumentsExamples contains examples for querying fields with arrays and embedded documents.
QueryArraysExamples contains examples for querying array fields.
QueryEmbeddedDocumentsExamples contains examples for querying embedded document fields.
QueryNullMissingFieldsExamples contains examples for querying fields that are null or missing.
QueryToplevelFieldsExamples contains examples for querying top-level fields.
RunCommandExamples contains examples of RunCommand operations.
RunTransactionWithRetry is an example function demonstrating transaction retry logic.
SnapshotQuery examples runs examples of using sessions with Snapshot enabled.
StableAPIDeprecationErrorsExample is an example of creating a client with stable API with deprecation errors.
StableAPIExample is an example of creating a client with stable API.
StableAPIExamples runs all stable API examples.
StableAPINonStrictExample is an example of creating a client with non-strict stable API.
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.
StableAPIStrictExample is an example of creating a client with strict stable API.
TransactionsExamples contains examples for transaction operations.
UpdateEmployeeInfo is an example function demonstrating transactions.
UpdateExamples contains examples of update operations.
WithTransactionExample is an example of using the Session.WithTransaction function.