MongoSharper 1.0.21

There is a newer version of this package available.
See the version list below for details.
dotnet add package MongoSharper --version 1.0.21
                    
NuGet\Install-Package MongoSharper -Version 1.0.21
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MongoSharper" Version="1.0.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MongoSharper" Version="1.0.21" />
                    
Directory.Packages.props
<PackageReference Include="MongoSharper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MongoSharper --version 1.0.21
                    
#r "nuget: MongoSharper, 1.0.21"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MongoSharper@1.0.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MongoSharper&version=1.0.21
                    
Install as a Cake Addin
#tool nuget:?package=MongoSharper&version=1.0.21
                    
Install as a Cake Tool

Introduction

TODO: MongoSharper is a library project to facilitate normal crud operation with c# and mongodb

Features

  1. Normal CRUD Operation
  2. 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:

  1. Create(TEntity document)
    Creates a new document in the database.

  2. Task<TEntity> Replace(string id, TEntity newDocument)
    Replaces an existing document with a new document.

  3. Task<bool> Delete(string id)
    Deletes a document from the database.

  4. Task<TEntity> Get(Expression<Func<TEntity, bool>> filterExpression)
    Retrieves a document that matches the specified filter.

  5. Task<TEntity> GetById(string id)
    Retrieves a document by its identifier.

  6. Task<IEnumerable<TEntity>> Get()
    Retrieves all documents from the database.

  7. Task<IEnumerable<TEntity>> GetTop(int limit)
    Retrieves the top 'limit' documents from the database.

  8. 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.

  9. Task<bool> DeleteAllDocuments()
    Deletes all documents from the database.

  10. Task<IEnumerable<TEntity>> FilterBy(Expression<Func<TEntity, bool>> filterExpression)
    Filters documents based on the specified criteria.

  11. IQueryable<TEntity> GetAsQuerable()
    Retrieves documents as a queryable collection.

  12. IEnumerable<TEntity> GetTextSearchResults(string index, string searchField, string searchText)
    Performs a text search on the specified field.

  13. IEnumerable<TEntity> GetRegexSearchResults(string searchField, string regex, string index)
    Performs a regex search on the specified field.

  14. void CreateIndex(TEntity entity, string fieldName, string indexName, bool unique = false)
    Creates an index on a specified field of the entity.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.25 123 4/19/2025
1.0.24 102 4/19/2025
1.0.23 176 4/18/2025
1.0.22 167 4/2/2025
1.0.21 177 4/2/2025