Namespace MongoDB.Entities
Classes
AsObjectIdAttribute
Use this attribute to mark a string property to store the value in MongoDB as ObjectID if it is a valid ObjectId string. If it is not a valid ObjectId string, it will be stored as string. This is useful when using custom formats for the ID field.
AsyncEventHandlerExtensions
CollectionAttribute
Specifies a custom MongoDB collection name for an entity type.
Coordinates2D
Represents a 2D geographical coordinate consisting of longitude and latitude
DataStreamer
Provides the interface for uploading and downloading data chunks for file entities.
Date
A custom date/time type for precision datetime handling
DB
The main entrypoint for all data access methods of the library
DBContext
This db context class can be used as an alternative entry point instead of the DB static class.
Distinct<T, TProperty>
Represents a MongoDB Distinct command where you can get back distinct values for a given property of a given Entity.
DontPreserveAttribute
Properties that don't have this attribute will be omitted when using SavePreserving() TIP: These attribute decorations are only effective if you do not specify a preservation expression when calling SavePreserving()
Entity
Inherit this class for all entities you want to store in their own collection.
Extensions
Extension methods for entities
FieldAttribute
Specifies the field name and/or the order of the persisted document.
FileEntity
Inherit this base class in order to create your own File Entities
Find<T>
Represents a MongoDB Find command.
TIP: Specify your criteria using .Match() .Sort() .Skip() .Take() .Project() .Option() methods and finally call .Execute()
Note: For building queries, use the DB.Fluent* interfaces
Find<T, TProjection>
Represents a MongoDB Find command with the ability to project to a different result type.
TIP: Specify your criteria using .Match() .Sort() .Skip() .Take() .Project() .Option() methods and finally call .Execute()
FuzzyString
Use this type to store strings if you need fuzzy text searching with MongoDB
TIP: There's a default limit of 250 characters for ensuring best performance.
If you exceed the default limit, an exception will be thrown.
You can increase the limit by sacrificing performance/resource utilization by setting the static property
FuzzyString.CharacterLimit = 500
at startup.
GeoNear<T>
Fluent aggregation pipeline builder for GeoNear
IgnoreAttribute
Use this attribute to ignore a property when persisting an entity to the database.
IgnoreDefaultAttribute
Use this attribute to ignore a property when persisting an entity to the database if the value is null/default.
Index<T>
Represents an index creation command
TIP: Define the keys first with .Key() method and finally call the .Create() method.
InverseSideAttribute
Indicates that this property is the inverse side of a many-to-many relationship
JoinRecord
Represents a parent-child relationship between two entities.
TIP: The ParentID and ChildID switches around for many-to-many relationships depending on the side of the relationship you're accessing.
Many<TChild>
Represents a one-to-many/many-to-many relationship between two Entities.
WARNING: You have to initialize all instances of this class before accessing any of it's members.
Initialize from the constructor of the parent entity as follows:
this.InitOneToMany(() => Property);
this.InitManyToMany(() => Property, x => x.OtherProperty);
ManyBase
Base class providing shared state for Many'1 classes
Migration
Represents a migration history item in the database
ModifiedBy
ObjectIdAttribute
Use this attribute to mark a property in order to save it in MongoDB server as ObjectId
One<T>
Represents a one-to-one relationship with an IEntity.
OwnerSideAttribute
Indicates that this property is the owner side of a many-to-many relationship
PagedSearch<T>
Represents an aggregation query that retrieves results with easy paging support.
PagedSearch<T, TProjection>
Represents an aggregation query that retrieves results with easy paging support.
PreserveAttribute
Use this attribute on properties that you want to omit when using SavePreserving() instead of supplying an expression. TIP: These attribute decorations are only effective if you do not specify a preservation expression when calling SavePreserving()
Prop
This class provides methods to generate property path strings from lambda expression.
Replace<T>
Represents an UpdateOne command, which can replace the first matched document with a given entity
TIP: Specify a filter first with the .Match(). Then set entity with .WithEntity() and finally call .Execute() to run the command.
Template
A helper class to build a JSON command from a string with tag replacement
Template<T>
A helper class to build a JSON command from a string with tag replacement
Template<TInput, TResult>
A helper class to build a JSON command from a string with tag replacement
Transaction
Represents a transaction used to carry out inter-related write operations.
TIP: Remember to always call .Dispose() after use or enclose in a 'Using' statement.
IMPORTANT: Use the methods on this transaction to perform operations and not the methods on the DB class.
Update<T>
Represents an update command
TIP: Specify a filter first with the .Match(). Then set property values with .Modify() and finally call .Execute() to run the command.
UpdateAndGet<T>
Update and retrieve the first document that was updated.
TIP: Specify a filter first with the .Match(). Then set property values with .Modify() and finally call .Execute() to run the command.
UpdateAndGet<T, TProjection>
Update and retrieve the first document that was updated.
TIP: Specify a filter first with the .Match(). Then set property values with .Modify() and finally call .Execute() to run the command.
UpdateBase<T>
Watcher<T>
Watcher for subscribing to mongodb change streams.
Interfaces
ICreatedOn
Implement this interface on entities you want the library to automatically store the creation date with
IEntity
The contract for Entity classes
IMigration
The contract for writing user data migration classes
IModifiedOn
Implement this interface on entities you want the library to automatically store the modified date with