npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.adrenak.mongodb.entities.upm

v1.0.3

Published

UPM package for MongoDB.Entities. NOT updated regularly.

Downloads

7

Readme

nuget nuget tests license

MongoDB.Entities

This library simplifies access to mongodb by abstracting away the C# mongodb driver and providing some additional features on top of it. The API is clean and intuitive resulting in less lines of code that is more readable/ human friendly than driver code.

Advantages:

  • Never have to deal with ObjectIds, BsonDocuments & magic strings.
  • Built-in support for One-To-One, One-To-Many and Many-To-Many relationships.
  • Query data using LINQ, lambda expressions, filters and aggregation pipelines.
  • Sorting, paging and projecting is made convenient.
  • Simple data migration framework similar to EntityFramework.
  • Programatically define indexes.
  • Full text search (including fuzzy matching) with text indexes.
  • Multi-document transaction support.
  • Easy bulk operations.
  • Update with aggregation pipeline stages & array filters.
  • Easy GeoSpatial search.
  • Stream files in chunks to and from mongodb (GridFS alternative).
  • Multiple database support.
  • Project types supported: .Net Standard 2.0 (.Net Core 2.0 & .Net Framework 4.6.1 or higher)

Documentation

Code Sample

    //Initialize database connection
        new DB("bookshop","localhost");

    //Create and persist an entity
        var book = new Book { Title = "The Power Of Now" };
        book.Save();
 
    //Embed as document
        var dickens = new Author { Name = "Charles Dickens" };
        book.Author = dickens.ToDocument();
        book.Save();
    
    //One-To-One relationship
        var hemmingway = new Author { Name = "Ernest Hemmingway" };
        hemmingway.Save();
        book.MainAuthor = hemmingway;
        book.Save();

    //One-To-Many relationship
        var tolle = new Author { Name = "Eckhart Tolle" };
        tolle.Save();
        book.Authors.Add(tolle);

    //Many-To-Many relationship
        var genre = new Genre { Name = "Self Help" };
        genre.Save();
        book.AllGenres.Add(genre);
        genre.AllBooks.Add(book);

    //Queries
        var author = DB.Find<Author>().One("ID");

        var authors = DB.Find<Author>().Many(a => a.Publisher == "Harper Collins");

        var eckhart = DB.Queryable<Author>()
                        .Where(a => a.Name.Contains("Eckhart"))
                        .SingleOrDefault();

        var powerofnow = genre.AllBooks.ChildrenQueryable()
                                       .Where(b => b.Title.Contains("Power"))
                                       .SingleOrDefault();

        var selfhelp = book.AllGenres.ChildrenQueryable().First();

    //Delete
        book.MainAuthor.Delete();
        book.AllAuthors.DeleteAll();
        book.Delete();
        DB.Delete<Genre>(genre.ID);

Code Examples

Donations

if this library has made your life easier and you'd like to express your gratitude, you can donate a couple of bucks via paypal by clicking the button below: