MongoSharper 1.0.21
See the version list below for details.
dotnet add package MongoSharper --version 1.0.21
NuGet\Install-Package MongoSharper -Version 1.0.21
<PackageReference Include="MongoSharper" Version="1.0.21" />
<PackageVersion Include="MongoSharper" Version="1.0.21" />
<PackageReference Include="MongoSharper" />
paket add MongoSharper --version 1.0.21
#r "nuget: MongoSharper, 1.0.21"
#:package MongoSharper@1.0.21
#addin nuget:?package=MongoSharper&version=1.0.21
#tool nuget:?package=MongoSharper&version=1.0.21
Introduction
TODO: MongoSharper is a library project to facilitate normal crud operation with c# and mongodb
Features
- Normal CRUD Operation
- Atlas search Operation
Usage
Install package.
Install-Package MongoSharper -version [version number]
The usage is pretty simple, Just create an object of mongonetrepo and get going with all supported methods.
1.Create a model inheriting the DocumentBase Class
public class MyClass:DocumentBase
{
public string Myproperty1 {get;set;}
}
2.Replace TEntity with your model
3.Create a object of mongonetrepo
var mongonetRepo= new MongoNetRepo(myconnectionstring, mydatabasename)
4.Call the methods as required passing your model
mongonetRepo.Method(parameter)
Supported Methods:
Create(TEntity document)
Creates a new document in the database.Task<TEntity> Replace(string id, TEntity newDocument)
Replaces an existing document with a new document.Task<bool> Delete(string id)
Deletes a document from the database.Task<TEntity> Get(Expression<Func<TEntity, bool>> filterExpression)
Retrieves a document that matches the specified filter.Task<TEntity> GetById(string id)
Retrieves a document by its identifier.Task<IEnumerable<TEntity>> Get()
Retrieves all documents from the database.Task<IEnumerable<TEntity>> GetTop(int limit)
Retrieves the top 'limit' documents from the database.IEnumerable<TProjected> FilterBy<TProjected>(Expression<Func<TEntity, bool>> filterExpression, Expression<Func<TEntity, TProjected>> projectionExpression)
Filters documents based on the specified criteria and projects them into a different type.Task<bool> DeleteAllDocuments()
Deletes all documents from the database.Task<IEnumerable<TEntity>> FilterBy(Expression<Func<TEntity, bool>> filterExpression)
Filters documents based on the specified criteria.IQueryable<TEntity> GetAsQuerable()
Retrieves documents as a queryable collection.IEnumerable<TEntity> GetTextSearchResults(string index, string searchField, string searchText)
Performs a text search on the specified field.IEnumerable<TEntity> GetRegexSearchResults(string searchField, string regex, string index)
Performs a regex search on the specified field.void CreateIndex(TEntity entity, string fieldName, string indexName, bool unique = false)
Creates an index on a specified field of the entity.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- MongoDB.Bson (>= 3.3.0)
- MongoDB.Driver (>= 3.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.