Documentation ¶
Index ¶
- func IsErrDuplicateKey(err error) bool
- func IsErrEmptySlice(err error) bool
- func IsErrNetwork(err error) bool
- func IsErrNilCursor(err error) bool
- func IsErrNilDocument(err error) bool
- func IsErrNoDocuments(err error) bool
- func IsErrTimeout(err error) bool
- type AggregateOptions
- func (o *AggregateOptions) AllowDiskUse(v ...bool) *AggregateOptions
- func (o *AggregateOptions) BatchSize(v int32) *AggregateOptions
- func (o *AggregateOptions) BypassDocumentValidation(v ...bool) *AggregateOptions
- func (o *AggregateOptions) Collation(v *Collation) *AggregateOptions
- func (o *AggregateOptions) Comment(v string) *AggregateOptions
- func (o *AggregateOptions) Custom(v bson.M) *AggregateOptions
- func (o *AggregateOptions) Hint(v any) *AggregateOptions
- func (o *AggregateOptions) Let(v any) *AggregateOptions
- func (o *AggregateOptions) MaxAwaitTime(v time.Duration) *AggregateOptions
- func (o *AggregateOptions) MaxTime(v time.Duration) *AggregateOptions
- type AggregateResult
- type ArrayFilters
- type Collation
- type Collection
- func (c *Collection) Aggregate(result, pipeline []any, opts ...*AggregateOptions) *AggregateResult
- func (c *Collection) Count(filter any, opts ...*CountOptions) *CountResult
- func (c *Collection) CreateIndex(model IndexModel, opts ...*CreateIndexesOptions) *CreateIndexResult
- func (c *Collection) CreateIndexes(models []IndexModel, opts ...*CreateIndexesOptions) *CreateIndexesResult
- func (c *Collection) Delete(filter any, opts ...*DeleteOptions) *DeleteResult
- func (c *Collection) DeleteMany(filter any, opts ...*options.DeleteOptions) *DeleteResult
- func (c *Collection) DeleteOne(filter any, opts ...*DeleteOptions) *DeleteResult
- func (c *Collection) Distinct(key string, filter any, opts ...*DistinctOptions) *DistinctResult
- func (c *Collection) DropIndex(name string, opts ...*DropIndexesOptions) *DropIndexResult
- func (c *Collection) DropIndexes(opts ...*DropIndexesOptions) *DropIndexesResult
- func (c *Collection) Find(filter, result any, opts ...*FindOptions) *FindResult
- func (c *Collection) FindOne(filter, result any, opt ...*GetOptions) *SingleResult
- func (c *Collection) FindOneAndDelete(filter, result any, opt ...*FindOneAndDeleteOptions) *SingleResult
- func (c *Collection) FindOneAndReplace(filter, replacement, result any, opt ...*FindOneAndReplaceOptions) *SingleResult
- func (c *Collection) FindOneAndUpdate(filter, update, result any, opts ...*FindOneAndUpdateOptions) *SingleResult
- func (c *Collection) Get(filter, result any, opts ...*GetOptions) *SingleResult
- func (c *Collection) Insert(doc any, opts ...*InsertOneOptions) *InsertResult
- func (c *Collection) InsertMany(docs []any, opts ...*InsertManyOptions) *InsertManyResult
- func (c *Collection) InsertOne(doc any, opts ...*InsertOneOptions) *InsertResult
- func (c *Collection) ListIndexes(result []IndexModel, opts ...*ListIndexesOptions) *ListIndexesResult
- func (c *Collection) ReplaceOne(filter, replacement any, opts ...*ReplaceOptions) *UpdateResult
- func (c *Collection) Update(filter, update any, opts ...*UpdateOptions) *UpdateResult
- func (c *Collection) UpdateMany(filter, update any, opts ...*options.UpdateOptions) *UpdateResult
- func (c *Collection) UpdateOne(filter, update any, opts ...*UpdateOptions) *UpdateResult
- func (c *Collection) Watch(pipeline []any, opts ...*WatchOptions) *WatchResult
- func (c *Collection) WithContext(ctx context.Context) *Collection
- type CountOptions
- func (o *CountOptions) Collation(v *options.Collation) *CountOptions
- func (o *CountOptions) Comment(v string) *CountOptions
- func (o *CountOptions) Hint(v any) *CountOptions
- func (o *CountOptions) Limit(v int64) *CountOptions
- func (o *CountOptions) MaxTime(v time.Duration) *CountOptions
- func (o *CountOptions) Skip(v int64) *CountOptions
- type CountResult
- type CreateCollectionResult
- type CreateIndexResult
- type CreateIndexesOptions
- func (o *CreateIndexesOptions) CommitQuorumInt(v int32) *CreateIndexesOptions
- func (o *CreateIndexesOptions) CommitQuorumMajority() *CreateIndexesOptions
- func (o *CreateIndexesOptions) CommitQuorumString(v string) *CreateIndexesOptions
- func (o *CreateIndexesOptions) CommitQuorumVotingMembers() *CreateIndexesOptions
- func (o *CreateIndexesOptions) MaxTime(v time.Duration) *CreateIndexesOptions
- type CreateIndexesResult
- type CursorType
- type D
- type Database
- func (db *Database) Close(ctx ...context.Context) error
- func (db *Database) Collection(v string, ctx ...context.Context) *Collection
- func (db *Database) CreateCollection(v string, ctx ...context.Context) *CreateCollectionResult
- func (db *Database) DropCollection(v string) *DropCollectionResult
- func (db *Database) IsCollectionExists(v string) bool
- func (db *Database) ListCollectionNames(filter any, opts ...*ListCollectionsOptions) *ListCollectionsResult
- func (db *Database) ListCollections(result, filter any, opts ...*ListCollectionsOptions) *ListCollectionsResult
- func (db *Database) WithContext(ctx context.Context) *Database
- func (db *Database) WithTransaction(fn func(ctx mongo.SessionContext) (any, error), opt ...*TransactionOptions) (any, error)
- type DeleteOptions
- type DeleteResult
- type DistinctOptions
- type DistinctResult
- type DropCollectionResult
- type DropIndexResult
- type DropIndexesOptions
- type DropIndexesResult
- type FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Collation(v Collation) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Comment(v any) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Hint(v any) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Let(v any) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) MaxTime(v time.Duration) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Projection(v any) *FindOneAndDeleteOptions
- func (o *FindOneAndDeleteOptions) Sort(v any) *FindOneAndDeleteOptions
- type FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) BypassDocumentValidation(v ...bool) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Collation(v Collation) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Comment(v any) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Hint(v any) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Let(v any) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) MaxTime(v time.Duration) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Projection(v any) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) ReturnDocument(v ReturnDocument) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Sort(v any) *FindOneAndReplaceOptions
- func (o *FindOneAndReplaceOptions) Upsert(v ...bool) *FindOneAndReplaceOptions
- type FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) ArrayFilters(v ArrayFilters) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) BypassDocumentValidation(v ...bool) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Collation(v Collation) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Comment(v any) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Hint(v any) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Let(v any) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) MaxTime(v time.Duration) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Projection(v any) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) ReturnDocument(v ReturnDocument) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Sort(v any) *FindOneAndUpdateOptions
- func (o *FindOneAndUpdateOptions) Upsert(v ...bool) *FindOneAndUpdateOptions
- type FindOptions
- func (o *FindOptions) AllowDiskUse(v ...bool) *FindOptions
- func (o *FindOptions) AllowPartialResults(v ...bool) *FindOptions
- func (o *FindOptions) BatchSize(v int32) *FindOptions
- func (o *FindOptions) Collation(v *Collation) *FindOptions
- func (o *FindOptions) Comment(v string) *FindOptions
- func (o *FindOptions) CursorType(v CursorType) *FindOptions
- func (o *FindOptions) Hint(v any) *FindOptions
- func (o *FindOptions) Let(v any) *FindOptions
- func (o *FindOptions) Limit(v int64) *FindOptions
- func (o *FindOptions) Max(v any) *FindOptions
- func (o *FindOptions) MaxAwaitTime(v time.Duration) *FindOptions
- func (o *FindOptions) MaxTime(v time.Duration) *FindOptions
- func (o *FindOptions) MaxTimeMS(v time.Duration) *FindOptions
- func (o *FindOptions) Min(v any) *FindOptions
- func (o *FindOptions) NoCursorTimeout(v ...bool) *FindOptions
- func (o *FindOptions) OpLogReplay(v ...bool) *FindOptions
- func (o *FindOptions) Projection(v any) *FindOptions
- func (o *FindOptions) ReturnKey(v ...bool) *FindOptions
- func (o *FindOptions) ShowRecordID(v ...bool) *FindOptions
- func (o *FindOptions) Skip(v int64) *FindOptions
- func (o *FindOptions) Snapshot(v ...bool) *FindOptions
- func (o *FindOptions) Sort(v any) *FindOptions
- type FindResult
- type FullDocument
- type GetOptions
- func (o *GetOptions) AllowPartialResults(v ...bool) *GetOptions
- func (o *GetOptions) BatchSize(v int32) *GetOptions
- func (o *GetOptions) Collation(v *Collation) *GetOptions
- func (o *GetOptions) Comment(v string) *GetOptions
- func (o *GetOptions) Hint(v any) *GetOptions
- func (o *GetOptions) Max(v any) *GetOptions
- func (o *GetOptions) MaxTime(v time.Duration) *GetOptions
- func (o *GetOptions) Min(v any) *GetOptions
- func (o *GetOptions) NoCursorTimeout(v ...bool) *GetOptions
- func (o *GetOptions) OplogReplay(v ...bool) *GetOptions
- func (o *GetOptions) Projection(v any) *GetOptions
- func (o *GetOptions) ReturnKey(v ...bool) *GetOptions
- func (o *GetOptions) ShowRecordID(v ...bool) *GetOptions
- func (o *GetOptions) Skip(v int64) *GetOptions
- func (o *GetOptions) Snapshot(v ...bool) *GetOptions
- func (o *GetOptions) Sort(v any) *GetOptions
- type IndexModel
- type IndexOptions
- func (o *IndexOptions) Background(v ...bool) *IndexOptions
- func (o *IndexOptions) Bits(v int32) *IndexOptions
- func (o *IndexOptions) BucketSize(v int32) *IndexOptions
- func (o *IndexOptions) Collation(v *options.Collation) *IndexOptions
- func (o *IndexOptions) DefaultLanguage(v string) *IndexOptions
- func (o *IndexOptions) ExpireAfterSeconds(v int32) *IndexOptions
- func (o *IndexOptions) Hidden(v ...bool) *IndexOptions
- func (o *IndexOptions) LanguageOverride(v string) *IndexOptions
- func (o *IndexOptions) Max(v float64) *IndexOptions
- func (o *IndexOptions) Min(v float64) *IndexOptions
- func (o *IndexOptions) Name(v string) *IndexOptions
- func (o *IndexOptions) PartialFilterExpression(v any) *IndexOptions
- func (o *IndexOptions) Sparse(v ...bool) *IndexOptions
- func (o *IndexOptions) SphereVersion(v int32) *IndexOptions
- func (o *IndexOptions) StorageEngine(v any) *IndexOptions
- func (o *IndexOptions) TextVersion(v int32) *IndexOptions
- func (o *IndexOptions) Unique(v ...bool) *IndexOptions
- func (o *IndexOptions) Version(v int32) *IndexOptions
- func (o *IndexOptions) Weights(v any) *IndexOptions
- func (o *IndexOptions) WildcardProjection(v any) *IndexOptions
- type InsertManyOptions
- type InsertManyResult
- type InsertOneOptions
- type InsertResult
- type ListCollectionsOptions
- type ListCollectionsResult
- type ListIndexesOptions
- type ListIndexesResult
- type M
- type Options
- type ReplaceOptions
- func (o *ReplaceOptions) BypassDocumentValidation(v ...bool) *ReplaceOptions
- func (o *ReplaceOptions) Collation(v *options.Collation) *ReplaceOptions
- func (o *ReplaceOptions) Comment(v string) *ReplaceOptions
- func (o *ReplaceOptions) Hint(v any) *ReplaceOptions
- func (o *ReplaceOptions) Let(v any) *ReplaceOptions
- func (o *ReplaceOptions) Upsert(v ...bool) *ReplaceOptions
- type ReturnDocument
- type SingleResult
- type Timestamp
- type TransactionOptions
- func (o *TransactionOptions) MaxCommitTime(v *time.Duration) *TransactionOptions
- func (o *TransactionOptions) ReadConcern(v *readconcern.ReadConcern) *TransactionOptions
- func (o *TransactionOptions) ReadPref(v *readpref.ReadPref) *TransactionOptions
- func (o *TransactionOptions) WriteConcern(v *writeconcern.WriteConcern) *TransactionOptions
- type UpdateOptions
- func (o *UpdateOptions) ArrayFilters(v ArrayFilters) *UpdateOptions
- func (o *UpdateOptions) BypassDocumentValidation(v ...bool) *UpdateOptions
- func (o *UpdateOptions) Collation(v Collation) *UpdateOptions
- func (o *UpdateOptions) Comment(v string) *UpdateOptions
- func (o *UpdateOptions) Hint(v any) *UpdateOptions
- func (o *UpdateOptions) Let(v any) *UpdateOptions
- func (o *UpdateOptions) Upsert(v ...bool) *UpdateOptions
- type UpdateResult
- type WatchOptions
- func (o *WatchOptions) BatchSize(v int32) *WatchOptions
- func (o *WatchOptions) Collation(v Collation) *WatchOptions
- func (o *WatchOptions) Comment(v string) *WatchOptions
- func (o *WatchOptions) Custom(v bson.M) *WatchOptions
- func (o *WatchOptions) CustomPipeline(v bson.M) *WatchOptions
- func (o *WatchOptions) FullDocument(v FullDocument) *WatchOptions
- func (o *WatchOptions) FullDocumentBeforeChange(v FullDocument) *WatchOptions
- func (o *WatchOptions) MaxAwaitTime(v time.Duration) *WatchOptions
- func (o *WatchOptions) ResumeAfter(v any) *WatchOptions
- func (o *WatchOptions) ShowExpandedEvents(v ...bool) *WatchOptions
- func (o *WatchOptions) StartAfter(v any) *WatchOptions
- func (o *WatchOptions) StartAtOperationTime(v *Timestamp) *WatchOptions
- type WatchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrNoDocuments ¶
IsErrNoDocuments returns true if the error is a mongo.ErrNoDocuments.
Types ¶
type AggregateOptions ¶
type AggregateOptions struct {
// contains filtered or unexported fields
}
AggregateOptions is a wrapper around mongo options.
func NewAggregateOptions ¶
func NewAggregateOptions() *AggregateOptions
NewAggregateOptions creates a new AggregateOptions.
func (*AggregateOptions) AllowDiskUse ¶
func (o *AggregateOptions) AllowDiskUse(v ...bool) *AggregateOptions
AllowDiskUse specifies whether to allow disk use.
func (*AggregateOptions) BatchSize ¶
func (o *AggregateOptions) BatchSize(v int32) *AggregateOptions
BatchSize specifies the number of documents to return per batch.
func (*AggregateOptions) BypassDocumentValidation ¶
func (o *AggregateOptions) BypassDocumentValidation(v ...bool) *AggregateOptions
BypassDocumentValidation specifies whether to bypass document validation during the aggregate operation.
func (*AggregateOptions) Collation ¶
func (o *AggregateOptions) Collation(v *Collation) *AggregateOptions
Collation specifies a collation.
func (*AggregateOptions) Comment ¶
func (o *AggregateOptions) Comment(v string) *AggregateOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*AggregateOptions) Custom ¶
func (o *AggregateOptions) Custom(v bson.M) *AggregateOptions
Custom specifies options to be added to aggregate expression.
func (*AggregateOptions) Hint ¶
func (o *AggregateOptions) Hint(v any) *AggregateOptions
Hint specifies the index to use.
func (*AggregateOptions) Let ¶
func (o *AggregateOptions) Let(v any) *AggregateOptions
Let specifies variables that can be accessed in the pipeline.
func (*AggregateOptions) MaxAwaitTime ¶
func (o *AggregateOptions) MaxAwaitTime(v time.Duration) *AggregateOptions
MaxAwaitTime specifies the maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to tailable cursor queries issued against a replica set. The default value is nil, which means that there is no maximum await time.
func (*AggregateOptions) MaxTime ¶
func (o *AggregateOptions) MaxTime(v time.Duration) *AggregateOptions
MaxTime specifies the maximum amount of time to allow the query to run.
type AggregateResult ¶
type AggregateResult struct { // Err is the error that occurred during the operation, if any. Err error }
type ArrayFilters ¶
type ArrayFilters struct {
options.ArrayFilters
}
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection is a wrapper around mongo.Collection. It provides more simple methods for common operations.
func (*Collection) Aggregate ¶
func (c *Collection) Aggregate(result, pipeline []any, opts ...*AggregateOptions) *AggregateResult
Aggregate performs an aggregation framework pipeline against the collection.
func (*Collection) Count ¶
func (c *Collection) Count(filter any, opts ...*CountOptions) *CountResult
Count returns the number of documents in the collection.
func (*Collection) CreateIndex ¶
func (c *Collection) CreateIndex(model IndexModel, opts ...*CreateIndexesOptions) *CreateIndexResult
CreateIndex creates a single index on the collection.
func (*Collection) CreateIndexes ¶
func (c *Collection) CreateIndexes(models []IndexModel, opts ...*CreateIndexesOptions) *CreateIndexesResult
CreateIndexes creates multiple indexes on the collection.
func (*Collection) Delete ¶
func (c *Collection) Delete(filter any, opts ...*DeleteOptions) *DeleteResult
Delete is an alias for DeleteOne.
func (*Collection) DeleteMany ¶
func (c *Collection) DeleteMany(filter any, opts ...*options.DeleteOptions) *DeleteResult
DeleteMany deletes multiple documents from the collection.
func (*Collection) DeleteOne ¶
func (c *Collection) DeleteOne(filter any, opts ...*DeleteOptions) *DeleteResult
DeleteOne deletes a single document from the collection.
func (*Collection) Distinct ¶
func (c *Collection) Distinct(key string, filter any, opts ...*DistinctOptions) *DistinctResult
Distinct returns a list of distinct values for the given key across a single collection.
func (*Collection) DropIndex ¶
func (c *Collection) DropIndex(name string, opts ...*DropIndexesOptions) *DropIndexResult
DropIndex drops a single index from the collection.
func (*Collection) DropIndexes ¶
func (c *Collection) DropIndexes(opts ...*DropIndexesOptions) *DropIndexesResult
DropIndexes drops all indexes from the collection.
func (*Collection) Find ¶
func (c *Collection) Find(filter, result any, opts ...*FindOptions) *FindResult
Find returns all documents that match the filter.
func (*Collection) FindOne ¶
func (c *Collection) FindOne(filter, result any, opt ...*GetOptions) *SingleResult
FindOne returns the first document that matches the filter.
func (*Collection) FindOneAndDelete ¶
func (c *Collection) FindOneAndDelete(filter, result any, opt ...*FindOneAndDeleteOptions) *SingleResult
FindOneAndDelete returns the first document that matches the filter.
func (*Collection) FindOneAndReplace ¶
func (c *Collection) FindOneAndReplace(filter, replacement, result any, opt ...*FindOneAndReplaceOptions) *SingleResult
FindOneAndReplace returns the first document that matches the filter.
func (*Collection) FindOneAndUpdate ¶
func (c *Collection) FindOneAndUpdate(filter, update, result any, opts ...*FindOneAndUpdateOptions) *SingleResult
FindOneAndUpdate returns the first document that matches the filter.
func (*Collection) Get ¶
func (c *Collection) Get(filter, result any, opts ...*GetOptions) *SingleResult
Get returns the first document that matches the filter.
func (*Collection) Insert ¶
func (c *Collection) Insert(doc any, opts ...*InsertOneOptions) *InsertResult
Insert is an alias for InsertOne.
func (*Collection) InsertMany ¶
func (c *Collection) InsertMany(docs []any, opts ...*InsertManyOptions) *InsertManyResult
InsertMany inserts multiple documents into the collection.
func (*Collection) InsertOne ¶
func (c *Collection) InsertOne(doc any, opts ...*InsertOneOptions) *InsertResult
InsertOne inserts a single document into the collection.
func (*Collection) ListIndexes ¶
func (c *Collection) ListIndexes(result []IndexModel, opts ...*ListIndexesOptions) *ListIndexesResult
ListIndexes lists the indexes on the collection.
func (*Collection) ReplaceOne ¶
func (c *Collection) ReplaceOne(filter, replacement any, opts ...*ReplaceOptions) *UpdateResult
ReplaceOne replaces a single document in the collection.
func (*Collection) Update ¶
func (c *Collection) Update(filter, update any, opts ...*UpdateOptions) *UpdateResult
Update is an alias for UpdateOne.
func (*Collection) UpdateMany ¶
func (c *Collection) UpdateMany(filter, update any, opts ...*options.UpdateOptions) *UpdateResult
UpdateMany updates multiple documents in the collection.
func (*Collection) UpdateOne ¶
func (c *Collection) UpdateOne(filter, update any, opts ...*UpdateOptions) *UpdateResult
UpdateOne updates a single document in the collection.
func (*Collection) Watch ¶
func (c *Collection) Watch(pipeline []any, opts ...*WatchOptions) *WatchResult
Watch creates a change stream cursor for a collection.
func (*Collection) WithContext ¶
func (c *Collection) WithContext(ctx context.Context) *Collection
WithContext sets the context for the collection. This context will be used for all operations on the collection.
type CountOptions ¶
type CountOptions struct {
// contains filtered or unexported fields
}
CountOptions is a wrapper around mongo options.
func NewCountOptions ¶
func NewCountOptions() *CountOptions
NewCountOptions creates a new CountOptions.
func (*CountOptions) Collation ¶
func (o *CountOptions) Collation(v *options.Collation) *CountOptions
Collation specifies a collation.
func (*CountOptions) Comment ¶
func (o *CountOptions) Comment(v string) *CountOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*CountOptions) Hint ¶
func (o *CountOptions) Hint(v any) *CountOptions
Hint specifies the index to use.
func (*CountOptions) Limit ¶
func (o *CountOptions) Limit(v int64) *CountOptions
Limit specifies the maximum number of documents to count.
func (*CountOptions) MaxTime ¶
func (o *CountOptions) MaxTime(v time.Duration) *CountOptions
MaxTime specifies the maximum amount of time to allow the query to run.
func (*CountOptions) Skip ¶
func (o *CountOptions) Skip(v int64) *CountOptions
Skip specifies the number of documents to skip before returning.
type CountResult ¶
type CreateCollectionResult ¶
type CreateCollectionResult struct { // Err is the error that occurred during the operation, if any. Err error // Name is the name of the created collection. Name string // Collection is the created collection. Collection *Collection }
type CreateIndexResult ¶
type CreateIndexesOptions ¶
type CreateIndexesOptions struct {
// contains filtered or unexported fields
}
CreateIndexesOptions is a wrapper around mongo options.
func NewCreateIndexesOptions ¶
func NewCreateIndexesOptions() *CreateIndexesOptions
NewCreateIndexesOptions creates a new CreateIndexesOptions.
func (*CreateIndexesOptions) CommitQuorumInt ¶
func (o *CreateIndexesOptions) CommitQuorumInt(v int32) *CreateIndexesOptions
CommitQuorumInt specifies the number of data-bearing members of a replica set, including the primary, that must complete the index builds successfully before the primary marks the indexes as ready.
func (*CreateIndexesOptions) CommitQuorumMajority ¶
func (o *CreateIndexesOptions) CommitQuorumMajority() *CreateIndexesOptions
CommitQuorumMajority specifies the number of data-bearing members of a replica set, including the primary, that must complete the index builds successfully before the primary marks the indexes as ready.
func (*CreateIndexesOptions) CommitQuorumString ¶
func (o *CreateIndexesOptions) CommitQuorumString(v string) *CreateIndexesOptions
CommitQuorumString specifies the number of data-bearing members of a replica set, including the primary, that must complete the index builds successfully before the primary marks the indexes as ready.
func (*CreateIndexesOptions) CommitQuorumVotingMembers ¶
func (o *CreateIndexesOptions) CommitQuorumVotingMembers() *CreateIndexesOptions
CommitQuorumVotingMembers specifies the number of data-bearing members of a replica set, including the primary, that must complete the index builds successfully before the primary marks the indexes as ready.
func (*CreateIndexesOptions) MaxTime ¶
func (o *CreateIndexesOptions) MaxTime(v time.Duration) *CreateIndexesOptions
MaxTime specifies the maximum amount of time to allow the query to run.
type CreateIndexesResult ¶
type CursorType ¶
type CursorType int8
const ( // CursorNonTailable specifies that a cursor should close after retrieving the last data. CursorNonTailable CursorType = iota // CursorTailable specifies that a cursor should not close when the last data is retrieved and can be resumed later. CursorTailable // CursorTailableAwait specifies that a cursor should not close when the last data is retrieved and // that it should block for a certain amount of time for new data before returning no data. CursorTailableAwait )
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database ...
func (*Database) Collection ¶
func (db *Database) Collection(v string, ctx ...context.Context) *Collection
Collection returns a collection with the given name.
func (*Database) CreateCollection ¶
func (db *Database) CreateCollection(v string, ctx ...context.Context) *CreateCollectionResult
CreateCollection creates a new collection with the given name.
func (*Database) DropCollection ¶
func (db *Database) DropCollection(v string) *DropCollectionResult
DropCollection drops the collection with the given name.
func (*Database) IsCollectionExists ¶
IsCollectionExists checks if a collection with the given name exists.
func (*Database) ListCollectionNames ¶
func (db *Database) ListCollectionNames(filter any, opts ...*ListCollectionsOptions) *ListCollectionsResult
ListCollectionNames lists all collection names in the database.
func (*Database) ListCollections ¶
func (db *Database) ListCollections(result, filter any, opts ...*ListCollectionsOptions) *ListCollectionsResult
ListCollections lists all collections in the database.
func (*Database) WithTransaction ¶
func (db *Database) WithTransaction(fn func(ctx mongo.SessionContext) (any, error), opt ...*TransactionOptions) (any, error)
type DeleteOptions ¶
type DeleteOptions struct {
// contains filtered or unexported fields
}
DeleteOptions is a wrapper around mongo options.
func NewDeleteOptions ¶
func NewDeleteOptions() *DeleteOptions
NewDeleteOptions creates a new DeleteOptions.
func (*DeleteOptions) Collation ¶
func (o *DeleteOptions) Collation(v *options.Collation) *DeleteOptions
Collation specifies a collation.
func (*DeleteOptions) Comment ¶
func (o *DeleteOptions) Comment(v string) *DeleteOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*DeleteOptions) Hint ¶
func (o *DeleteOptions) Hint(v any) *DeleteOptions
Hint specifies the index to use.
func (*DeleteOptions) Let ¶
func (o *DeleteOptions) Let(v any) *DeleteOptions
Let specifies variables accessible from the delete expression.
type DeleteResult ¶
type DistinctOptions ¶
type DistinctOptions struct {
// contains filtered or unexported fields
}
DistinctOptions is a wrapper around mongo options.
func NewDistinctOptions ¶
func NewDistinctOptions() *DistinctOptions
NewDistinctOptions creates a new DistinctOptions.
func (*DistinctOptions) Collation ¶
func (o *DistinctOptions) Collation(v *Collation) *DistinctOptions
Collation specifies a collation.
func (*DistinctOptions) Comment ¶
func (o *DistinctOptions) Comment(v string) *DistinctOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*DistinctOptions) MaxTime ¶
func (o *DistinctOptions) MaxTime(v time.Duration) *DistinctOptions
MaxTime specifies the maximum amount of time to allow the query to run.
type DistinctResult ¶
type DropCollectionResult ¶
type DropIndexResult ¶
type DropIndexesOptions ¶
type DropIndexesOptions struct {
// contains filtered or unexported fields
}
DropIndexesOptions is a wrapper around mongo options.
func NewDropIndexesOptions ¶
func NewDropIndexesOptions() *DropIndexesOptions
NewDropIndexesOptions creates a new DropIndexesOptions.
func (*DropIndexesOptions) MaxTime ¶
func (o *DropIndexesOptions) MaxTime(v time.Duration) *DropIndexesOptions
MaxTime specifies the maximum amount of time to allow the query to run.
type DropIndexesResult ¶
type FindOneAndDeleteOptions ¶
type FindOneAndDeleteOptions struct {
// contains filtered or unexported fields
}
FindOneAndDeleteOptions is a wrapper around mongo options.
func NewFindOneAndDeleteOptions ¶
func NewFindOneAndDeleteOptions() *FindOneAndDeleteOptions
NewFindOneAndDeleteOptions creates a new FindOneAndDeleteOptions.
func (*FindOneAndDeleteOptions) Collation ¶
func (o *FindOneAndDeleteOptions) Collation(v Collation) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) Comment ¶
func (o *FindOneAndDeleteOptions) Comment(v any) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) Hint ¶
func (o *FindOneAndDeleteOptions) Hint(v any) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) Let ¶
func (o *FindOneAndDeleteOptions) Let(v any) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) MaxTime ¶
func (o *FindOneAndDeleteOptions) MaxTime(v time.Duration) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) Projection ¶
func (o *FindOneAndDeleteOptions) Projection(v any) *FindOneAndDeleteOptions
func (*FindOneAndDeleteOptions) Sort ¶
func (o *FindOneAndDeleteOptions) Sort(v any) *FindOneAndDeleteOptions
type FindOneAndReplaceOptions ¶
type FindOneAndReplaceOptions struct {
// contains filtered or unexported fields
}
FindOneAndReplaceOptions is a wrapper around mongo options.
func NewFindOneAndReplaceOptions ¶
func NewFindOneAndReplaceOptions() *FindOneAndReplaceOptions
NewFindOneAndReplaceOptions creates a new FindOneAndReplaceOptions.
func (*FindOneAndReplaceOptions) BypassDocumentValidation ¶
func (o *FindOneAndReplaceOptions) BypassDocumentValidation(v ...bool) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Collation ¶
func (o *FindOneAndReplaceOptions) Collation(v Collation) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Comment ¶
func (o *FindOneAndReplaceOptions) Comment(v any) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Hint ¶
func (o *FindOneAndReplaceOptions) Hint(v any) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Let ¶
func (o *FindOneAndReplaceOptions) Let(v any) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) MaxTime ¶
func (o *FindOneAndReplaceOptions) MaxTime(v time.Duration) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Projection ¶
func (o *FindOneAndReplaceOptions) Projection(v any) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) ReturnDocument ¶
func (o *FindOneAndReplaceOptions) ReturnDocument(v ReturnDocument) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Sort ¶
func (o *FindOneAndReplaceOptions) Sort(v any) *FindOneAndReplaceOptions
func (*FindOneAndReplaceOptions) Upsert ¶
func (o *FindOneAndReplaceOptions) Upsert(v ...bool) *FindOneAndReplaceOptions
type FindOneAndUpdateOptions ¶
type FindOneAndUpdateOptions struct {
// contains filtered or unexported fields
}
FindOneAndUpdateOptions is a wrapper around mongo options.
func NewFindOneAndUpdateOptions ¶
func NewFindOneAndUpdateOptions() *FindOneAndUpdateOptions
NewFindOneAndUpdateOptions creates a new FindOneAndUpdateOptions.
func (*FindOneAndUpdateOptions) ArrayFilters ¶
func (o *FindOneAndUpdateOptions) ArrayFilters(v ArrayFilters) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) BypassDocumentValidation ¶
func (o *FindOneAndUpdateOptions) BypassDocumentValidation(v ...bool) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Collation ¶
func (o *FindOneAndUpdateOptions) Collation(v Collation) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Comment ¶
func (o *FindOneAndUpdateOptions) Comment(v any) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Hint ¶
func (o *FindOneAndUpdateOptions) Hint(v any) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Let ¶
func (o *FindOneAndUpdateOptions) Let(v any) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) MaxTime ¶
func (o *FindOneAndUpdateOptions) MaxTime(v time.Duration) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Projection ¶
func (o *FindOneAndUpdateOptions) Projection(v any) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) ReturnDocument ¶
func (o *FindOneAndUpdateOptions) ReturnDocument(v ReturnDocument) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Sort ¶
func (o *FindOneAndUpdateOptions) Sort(v any) *FindOneAndUpdateOptions
func (*FindOneAndUpdateOptions) Upsert ¶
func (o *FindOneAndUpdateOptions) Upsert(v ...bool) *FindOneAndUpdateOptions
type FindOptions ¶
type FindOptions struct {
// contains filtered or unexported fields
}
FindOptions is a wrapper around mongo options.
func (*FindOptions) AllowDiskUse ¶
func (o *FindOptions) AllowDiskUse(v ...bool) *FindOptions
AllowDiskUse enables writing to temporary files.
func (*FindOptions) AllowPartialResults ¶
func (o *FindOptions) AllowPartialResults(v ...bool) *FindOptions
AllowPartialResults specifies that a cursor should not error when some shards are unavailable.
func (*FindOptions) BatchSize ¶
func (o *FindOptions) BatchSize(v int32) *FindOptions
BatchSize sets the number of documents to return in each batch.
func (*FindOptions) Collation ¶
func (o *FindOptions) Collation(v *Collation) *FindOptions
Collation specifies a collation.
func (*FindOptions) Comment ¶
func (o *FindOptions) Comment(v string) *FindOptions
Comment adds a comment to the query.
func (*FindOptions) CursorType ¶
func (o *FindOptions) CursorType(v CursorType) *FindOptions
CursorType sets the type of cursor to use.
func (*FindOptions) Hint ¶
func (o *FindOptions) Hint(v any) *FindOptions
Hint sets the index to use.
func (*FindOptions) Let ¶
func (o *FindOptions) Let(v any) *FindOptions
Let specifies variables to use in the query.
func (*FindOptions) Limit ¶
func (o *FindOptions) Limit(v int64) *FindOptions
Limit sets the limit for the query.
func (*FindOptions) Max ¶
func (o *FindOptions) Max(v any) *FindOptions
Max specifies the exclusive upper bound for a specific index.
func (*FindOptions) MaxAwaitTime ¶
func (o *FindOptions) MaxAwaitTime(v time.Duration) *FindOptions
MaxAwaitTime sets the maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies when CursorType is set to CursorTailableAwait.
func (*FindOptions) MaxTime ¶
func (o *FindOptions) MaxTime(v time.Duration) *FindOptions
MaxTime sets the maximum amount of time to allow the query to run.
func (*FindOptions) MaxTimeMS ¶
func (o *FindOptions) MaxTimeMS(v time.Duration) *FindOptions
MaxTimeMS sets the maximum amount of time to allow the query to run.
func (*FindOptions) Min ¶
func (o *FindOptions) Min(v any) *FindOptions
Min specifies the inclusive lower bound for a specific index.
func (*FindOptions) NoCursorTimeout ¶
func (o *FindOptions) NoCursorTimeout(v ...bool) *FindOptions
NoCursorTimeout specifies that a cursor should not time out after a period of inactivity.
func (*FindOptions) OpLogReplay ¶
func (o *FindOptions) OpLogReplay(v ...bool) *FindOptions
OpLogReplay specifies that a cursor should use the oplog for the query.
func (*FindOptions) Projection ¶
func (o *FindOptions) Projection(v any) *FindOptions
Projection sets the fields to return for all matching documents.
func (*FindOptions) ReturnKey ¶
func (o *FindOptions) ReturnKey(v ...bool) *FindOptions
ReturnKey specifies that a cursor should only return the index field or fields for the results.
func (*FindOptions) ShowRecordID ¶
func (o *FindOptions) ShowRecordID(v ...bool) *FindOptions
ShowRecordID specifies that a cursor should return the record identifier for each document.
func (*FindOptions) Skip ¶
func (o *FindOptions) Skip(v int64) *FindOptions
Skip sets the number of documents to skip before returning.
func (*FindOptions) Snapshot ¶
func (o *FindOptions) Snapshot(v ...bool) *FindOptions
Snapshot specifies that a cursor should use a snapshot for the query.
func (*FindOptions) Sort ¶
func (o *FindOptions) Sort(v any) *FindOptions
Sort sets the order in which to return matching documents.
type FindResult ¶
type FindResult struct { // Err is the error that occurred during the operation, if any. Err error }
type FullDocument ¶
type FullDocument string
FullDocument specifies how a change stream should return the modified document.
const ( // FullDocumentDefault does not include a document copy. FullDocumentDefault FullDocument = "default" // FullDocumentOff is the same as sending no value for fullDocumentBeforeChange. FullDocumentOff FullDocument = "off" // FullDocumentRequired is the same as WhenAvailable but raises a server-side error if the post-image is not available. FullDocumentRequired FullDocument = "required" // FullDocumentUpdateLookup includes a delta describing the changes to the document and a copy of the entire document that // was changed. FullDocumentUpdateLookup FullDocument = "updateLookup" // FullDocumentWhenAvailable includes a post-image of the the modified document for replace and update change events // if the post-image for this event is available. FullDocumentWhenAvailable FullDocument = "whenAvailable" )
type GetOptions ¶
type GetOptions struct {
// contains filtered or unexported fields
}
GetOptions is a wrapper around mongo options.
func (*GetOptions) AllowPartialResults ¶
func (o *GetOptions) AllowPartialResults(v ...bool) *GetOptions
AllowPartialResults specifies whether to allow partial results if some shards are
func (*GetOptions) BatchSize ¶
func (o *GetOptions) BatchSize(v int32) *GetOptions
BatchSize specifies the maximum number of documents to return in the batch.
func (*GetOptions) Collation ¶
func (o *GetOptions) Collation(v *Collation) *GetOptions
Collation specifies a collation.
func (*GetOptions) Comment ¶
func (o *GetOptions) Comment(v string) *GetOptions
Comment specifies a string to help trace the operation through the database profiler, currentOp and logs.
func (*GetOptions) Hint ¶
func (o *GetOptions) Hint(v any) *GetOptions
Hint specifies the index to use.
func (*GetOptions) Max ¶
func (o *GetOptions) Max(v any) *GetOptions
Max specifies the exclusive upper bound for a specific index.
func (*GetOptions) MaxTime ¶
func (o *GetOptions) MaxTime(v time.Duration) *GetOptions
MaxTime specifies the maximum amount of time to allow the query to run.
func (*GetOptions) Min ¶
func (o *GetOptions) Min(v any) *GetOptions
Min specifies the inclusive lower bound for a specific index.
func (*GetOptions) NoCursorTimeout ¶
func (o *GetOptions) NoCursorTimeout(v ...bool) *GetOptions
NoCursorTimeout specifies whether to allow the cursor to timeout.
func (*GetOptions) OplogReplay ¶
func (o *GetOptions) OplogReplay(v ...bool) *GetOptions
OplogReplay specifies whether to allow the cursor to timeout.
func (*GetOptions) Projection ¶
func (o *GetOptions) Projection(v any) *GetOptions
Projection specifies the fields to return.
func (*GetOptions) ReturnKey ¶
func (o *GetOptions) ReturnKey(v ...bool) *GetOptions
ReturnKey specifies whether to only return the index keys in the resulting documents.
func (*GetOptions) ShowRecordID ¶
func (o *GetOptions) ShowRecordID(v ...bool) *GetOptions
ShowRecordID specifies whether to add a record identifier for each document.
func (*GetOptions) Skip ¶
func (o *GetOptions) Skip(v int64) *GetOptions
Skip specifies the number of documents to skip before returning.
func (*GetOptions) Snapshot ¶
func (o *GetOptions) Snapshot(v ...bool) *GetOptions
Snapshot specifies whether to prevent the cursor from returning a document more than once because of an intervening write operation.
func (*GetOptions) Sort ¶
func (o *GetOptions) Sort(v any) *GetOptions
Sort specifies the order in which to return results.
type IndexModel ¶
type IndexModel struct { // Keys is a document that contains the index keys and their corresponding sort order. Keys any Options *IndexOptions }
IndexModel is a model for an index to create.
func NewIndexModel ¶
func NewIndexModel(keys any, options ...*IndexOptions) IndexModel
NewIndexModel creates a new IndexModel.
type IndexOptions ¶
type IndexOptions struct {
// contains filtered or unexported fields
}
IndexOptions is a wrapper around mongo options.
func NewIndexOptions ¶
func NewIndexOptions() *IndexOptions
NewIndexOptions creates a new IndexOptions.
func (*IndexOptions) Background ¶
func (o *IndexOptions) Background(v ...bool) *IndexOptions
Background specifies whether the index should be built in the background.
func (*IndexOptions) Bits ¶
func (o *IndexOptions) Bits(v int32) *IndexOptions
Bits specifies the number of precision of the stored geohash value of the 2d index.
func (*IndexOptions) BucketSize ¶
func (o *IndexOptions) BucketSize(v int32) *IndexOptions
BucketSize specifies the number of units within which to group the location values for the geoHaystack index.
func (*IndexOptions) Collation ¶
func (o *IndexOptions) Collation(v *options.Collation) *IndexOptions
Collation specifies a collation.
func (*IndexOptions) DefaultLanguage ¶
func (o *IndexOptions) DefaultLanguage(v string) *IndexOptions
DefaultLanguage specifies the default language for the index.
func (*IndexOptions) ExpireAfterSeconds ¶
func (o *IndexOptions) ExpireAfterSeconds(v int32) *IndexOptions
ExpireAfterSeconds specifies the number of seconds after which documents in the collection should expire.
func (*IndexOptions) Hidden ¶
func (o *IndexOptions) Hidden(v ...bool) *IndexOptions
Hidden specifies whether the index should be hidden.
func (*IndexOptions) LanguageOverride ¶
func (o *IndexOptions) LanguageOverride(v string) *IndexOptions
LanguageOverride specifies the field in the document that contains the override language for the index.
func (*IndexOptions) Max ¶
func (o *IndexOptions) Max(v float64) *IndexOptions
Max specifies the upper inclusive boundary for the longitude and latitude values for the 2d index.
func (*IndexOptions) Min ¶
func (o *IndexOptions) Min(v float64) *IndexOptions
Min specifies the lower inclusive boundary for the longitude and latitude values for the 2d index.
func (*IndexOptions) Name ¶
func (o *IndexOptions) Name(v string) *IndexOptions
Name specifies the name of the index.
func (*IndexOptions) PartialFilterExpression ¶
func (o *IndexOptions) PartialFilterExpression(v any) *IndexOptions
PartialFilterExpression specifies a filter document that determines which documents in the collection should be included in the index.
func (*IndexOptions) Sparse ¶
func (o *IndexOptions) Sparse(v ...bool) *IndexOptions
Sparse specifies whether the index only references documents with the specified field.
func (*IndexOptions) SphereVersion ¶
func (o *IndexOptions) SphereVersion(v int32) *IndexOptions
SphereVersion specifies the version of the 2dsphere index.
func (*IndexOptions) StorageEngine ¶
func (o *IndexOptions) StorageEngine(v any) *IndexOptions
StorageEngine specifies storage engine options for the index.
func (*IndexOptions) TextVersion ¶
func (o *IndexOptions) TextVersion(v int32) *IndexOptions
TextVersion specifies the version of the text index.
func (*IndexOptions) Unique ¶
func (o *IndexOptions) Unique(v ...bool) *IndexOptions
Unique specifies whether the index should enforce a unique constraint on the indexed field.
func (*IndexOptions) Version ¶
func (o *IndexOptions) Version(v int32) *IndexOptions
Version specifies the version number of the index.
func (*IndexOptions) Weights ¶
func (o *IndexOptions) Weights(v any) *IndexOptions
Weights specifies the weight for each field in the index.
func (*IndexOptions) WildcardProjection ¶
func (o *IndexOptions) WildcardProjection(v any) *IndexOptions
WildcardProjection specifies a document that contains a field and its associated wildcard projection.
type InsertManyOptions ¶
type InsertManyOptions struct {
// contains filtered or unexported fields
}
InsertManyOptions is a wrapper around mongo options.
func NewInsertManyOptions ¶
func NewInsertManyOptions() *InsertManyOptions
NewInsertManyOptions creates a new InsertManyOptions.
func (*InsertManyOptions) BypassDocumentValidation ¶
func (o *InsertManyOptions) BypassDocumentValidation(v ...bool) *InsertManyOptions
BypassDocumentValidation specifies whether to bypass document validation during the insert operation.
func (*InsertManyOptions) Comment ¶
func (o *InsertManyOptions) Comment(v string) *InsertManyOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*InsertManyOptions) Ordered ¶
func (o *InsertManyOptions) Ordered(v ...bool) *InsertManyOptions
Ordered specifies whether the operations in the bulk write should be executed in order.
type InsertManyResult ¶
type InsertOneOptions ¶
type InsertOneOptions struct {
// contains filtered or unexported fields
}
InsertOneOptions is a wrapper around mongo options.
func NewInsertOneOptions ¶
func NewInsertOneOptions() *InsertOneOptions
NewInsertOneOptions creates a new InsertOneOptions.
func (*InsertOneOptions) BypassDocumentValidation ¶
func (o *InsertOneOptions) BypassDocumentValidation(v ...bool) *InsertOneOptions
BypassDocumentValidation specifies whether to bypass document validation during the insert operation.
func (*InsertOneOptions) Comment ¶
func (o *InsertOneOptions) Comment(v string) *InsertOneOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
type InsertResult ¶
type ListCollectionsOptions ¶
type ListCollectionsOptions struct {
// contains filtered or unexported fields
}
func NewListCollectionsOptions ¶
func NewListCollectionsOptions() *ListCollectionsOptions
func (*ListCollectionsOptions) AuthorizedCollections ¶
func (o *ListCollectionsOptions) AuthorizedCollections(v bool) *ListCollectionsOptions
AuthorizedCollections specifies whether to limit the documents returned to only contain collections the user is authorized to use.
func (*ListCollectionsOptions) BatchSize ¶
func (o *ListCollectionsOptions) BatchSize(v int32) *ListCollectionsOptions
BatchSize specifies the maximum number of documents to be included in each batch returned by the server.
func (*ListCollectionsOptions) NameOnly ¶
func (o *ListCollectionsOptions) NameOnly(v bool) *ListCollectionsOptions
NameOnly specifies whether to limit the documents returned to only contain the name of the collection.
type ListCollectionsResult ¶
type ListIndexesOptions ¶
type ListIndexesOptions struct {
// contains filtered or unexported fields
}
ListIndexesOptions is a wrapper around mongo options.
func NewListIndexesOptions ¶
func NewListIndexesOptions() *ListIndexesOptions
NewListIndexesOptions creates a new ListIndexesOptions.
func (*ListIndexesOptions) BatchSize ¶
func (o *ListIndexesOptions) BatchSize(v int32) *ListIndexesOptions
BatchSize specifies the maximum number of documents to return in each batch of the returned cursor.
func (*ListIndexesOptions) MaxTime ¶
func (o *ListIndexesOptions) MaxTime(v time.Duration) *ListIndexesOptions
MaxTime specifies the maximum amount of time to allow the query to run.
type ListIndexesResult ¶
type ListIndexesResult struct { // Err is the error that occurred during the operation, if any. Err error }
type Options ¶
type Options[T any] interface { // contains filtered or unexported methods }
Options is a wrapper around mongo options.
type ReplaceOptions ¶
type ReplaceOptions struct {
// contains filtered or unexported fields
}
ReplaceOptions is a wrapper around mongo options.
func NewReplaceOptions ¶
func NewReplaceOptions() *ReplaceOptions
NewReplaceOptions creates a new ReplaceOptions.
func (*ReplaceOptions) BypassDocumentValidation ¶
func (o *ReplaceOptions) BypassDocumentValidation(v ...bool) *ReplaceOptions
BypassDocumentValidation specifies whether to bypass document validation during the replace operation.
func (*ReplaceOptions) Collation ¶
func (o *ReplaceOptions) Collation(v *options.Collation) *ReplaceOptions
Collation specifies a collation.
func (*ReplaceOptions) Comment ¶
func (o *ReplaceOptions) Comment(v string) *ReplaceOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*ReplaceOptions) Hint ¶
func (o *ReplaceOptions) Hint(v any) *ReplaceOptions
Hint specifies the index to use.
func (*ReplaceOptions) Let ¶
func (o *ReplaceOptions) Let(v any) *ReplaceOptions
Let specifies variables accessible from the replace expression.
func (*ReplaceOptions) Upsert ¶
func (o *ReplaceOptions) Upsert(v ...bool) *ReplaceOptions
Upsert specifies whether to insert a new document if no documents match the filter.
type ReturnDocument ¶
type ReturnDocument int32
type SingleResult ¶
type SingleResult struct { // Err is the error that occurred during the operation, if any. Err error }
func (*SingleResult) IsNotFound ¶
func (r *SingleResult) IsNotFound() bool
type TransactionOptions ¶
type TransactionOptions struct {
// contains filtered or unexported fields
}
TransactionOptions is a wrapper around mongo transaction options.
func NewTransactionOptions ¶
func NewTransactionOptions() *TransactionOptions
NewTransactionOptions creates a new TransactionOptions.
func (*TransactionOptions) MaxCommitTime ¶
func (o *TransactionOptions) MaxCommitTime(v *time.Duration) *TransactionOptions
MaxCommitTime specifies the maximum amount of time that a CommitTransaction operation can run on the server.
func (*TransactionOptions) ReadConcern ¶
func (o *TransactionOptions) ReadConcern(v *readconcern.ReadConcern) *TransactionOptions
ReadConcern specifies the read concern for the transaction.
func (*TransactionOptions) ReadPref ¶
func (o *TransactionOptions) ReadPref(v *readpref.ReadPref) *TransactionOptions
ReadPref specifies the read preference for the transaction.
func (*TransactionOptions) WriteConcern ¶
func (o *TransactionOptions) WriteConcern(v *writeconcern.WriteConcern) *TransactionOptions
WriteConcern specifies the write concern for the transaction.
type UpdateOptions ¶
type UpdateOptions struct {
// contains filtered or unexported fields
}
UpdateOptions is a wrapper around mongo options.
func NewUpdateOptions ¶
func NewUpdateOptions() *UpdateOptions
NewUpdateOptions creates a new UpdateOptions.
func (*UpdateOptions) ArrayFilters ¶
func (o *UpdateOptions) ArrayFilters(v ArrayFilters) *UpdateOptions
ArrayFilters specifies an array of filters specifying to which array elements an update should apply.
func (*UpdateOptions) BypassDocumentValidation ¶
func (o *UpdateOptions) BypassDocumentValidation(v ...bool) *UpdateOptions
BypassDocumentValidation specifies whether to bypass document validation during the update operation.
func (*UpdateOptions) Collation ¶
func (o *UpdateOptions) Collation(v Collation) *UpdateOptions
Collation specifies a collation.
func (*UpdateOptions) Comment ¶
func (o *UpdateOptions) Comment(v string) *UpdateOptions
Comment specifies a string or document that will be included in server logs, profiling logs, and currentOp queries to help trace the operation. The default value is nil, which means that no comment will be included in the logs.
func (*UpdateOptions) Hint ¶
func (o *UpdateOptions) Hint(v any) *UpdateOptions
Hint specifies the index to use. The default value is nil, which means that no hint will be sent.
func (*UpdateOptions) Let ¶
func (o *UpdateOptions) Let(v any) *UpdateOptions
Let specifies variables accessible from the update expression.
func (*UpdateOptions) Upsert ¶
func (o *UpdateOptions) Upsert(v ...bool) *UpdateOptions
Upsert specifies whether to insert a new document if no documents match the filter.
type UpdateResult ¶
type UpdateResult struct { // Err is the error that occurred during the operation, if any. Err error // MatchedCount is the number of documents matched by the filter. MatchedCount int64 // ModifiedCount is the number of documents modified by the operation. ModifiedCount int64 // UpsertedCount is the number of documents upserted by the operation. UpsertedCount int64 // UpsertedID is the _id of the upserted document, or nil if no document was upserted. UpsertedID any }
type WatchOptions ¶
type WatchOptions struct {
// contains filtered or unexported fields
}
WatchOptions is a wrapper around mongo options.
func NewWatchOptions ¶
func NewWatchOptions() *WatchOptions
NewWatchOptions creates a new WatchOptions.
func (*WatchOptions) BatchSize ¶
func (o *WatchOptions) BatchSize(v int32) *WatchOptions
BatchSize sets the number of documents to return in each batch.
func (*WatchOptions) Collation ¶
func (o *WatchOptions) Collation(v Collation) *WatchOptions
Collation specifies a collation.
func (*WatchOptions) Comment ¶
func (o *WatchOptions) Comment(v string) *WatchOptions
Comment adds a comment to the query.
func (*WatchOptions) CustomPipeline ¶
func (o *WatchOptions) CustomPipeline(v bson.M) *WatchOptions
CustomPipeline ...
func (*WatchOptions) FullDocument ¶
func (o *WatchOptions) FullDocument(v FullDocument) *WatchOptions
FullDocument specifies whether to return the full document or just the changes to the document.
func (*WatchOptions) FullDocumentBeforeChange ¶
func (o *WatchOptions) FullDocumentBeforeChange(v FullDocument) *WatchOptions
FullDocumentBeforeChange specifies whether to return the full document before the change occurred.
func (*WatchOptions) MaxAwaitTime ¶
func (o *WatchOptions) MaxAwaitTime(v time.Duration) *WatchOptions
MaxAwaitTime specifies the maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to tailable cursor queries issued against a replica set. The default value is nil, which means that there is no maximum await time.
func (*WatchOptions) ResumeAfter ¶
func (o *WatchOptions) ResumeAfter(v any) *WatchOptions
ResumeAfter specifies the logical starting point for the new change stream.
func (*WatchOptions) ShowExpandedEvents ¶
func (o *WatchOptions) ShowExpandedEvents(v ...bool) *WatchOptions
ShowExpandedEvents specifies whether to include the postImage field in update notifications.
func (*WatchOptions) StartAfter ¶
func (o *WatchOptions) StartAfter(v any) *WatchOptions
StartAfter specifies the logical starting point for the new change stream.
func (*WatchOptions) StartAtOperationTime ¶
func (o *WatchOptions) StartAtOperationTime(v *Timestamp) *WatchOptions
StartAtOperationTime specifies a logical starting point for the new change stream.
type WatchResult ¶
type WatchResult struct { // Err is the error that occurred during the operation, if any. Err error // contains filtered or unexported fields }
func (*WatchResult) Get ¶
func (r *WatchResult) Get(v any) error
Source Files ¶
- aggregate_options.go
- bson.go
- collection.go
- count_options.go
- create_indexes_options.go
- delete_options.go
- distinct_options.go
- drop_indexes.go
- error.go
- find_one_and_delete_options.go
- find_one_and_replace_options.go
- find_one_and_update_options.go
- find_one_options.go
- find_options.go
- index.go
- index_options.go
- insert_many_options.go
- insert_one_options.go
- list_collections_options.go
- list_indexes_options.go
- mgx.go
- options.go
- replace_options.go
- result.go
- timestamp.go
- transaction_options.go
- update_options.go
- watch_options.go