GithubHelp home page GithubHelp logo

dmongo's Introduction

DMongo - Dynamic wrapper for the CSharp Mongo Driver

This is an wrapper of the CSharpDriver for Mongo, using the Microsoft Dynamic syntax.

The idea behind this implementation is to create a DSL simple to use, more oriented to the Mongo Shell commands.

  • Using the CSharpDriver for Mongo

     //Connection
     var connectionString = "mongodb://localhost/?safe=true";
     var server = MongoServer.Create(connectionString);
     var database = server.GetDatabase("test");
     var collection = database.GetCollection<Entity>("mycollection");
     
     //Insert:
     var entity = new Entity { Name = "Tom" };
     collection.Insert(entity);
     var id = entity.Id;
     
     //Query:
     var query = Query.EQ("_id", id);
     entity = collection.FindOne(query);
     Console.WriteLine("Result: {0}",entity.Name);

This example was taken from: CSharp Driver Quick Start There is a Test case based on the example above.

  • Using DMongo: A simple way to use the collections (like the mongo shell)

     //Instance
     var mongo = new Mongo("mongo://localhost/?safe=true");
     var db = mongo.GetDatabase("test");	
     
     //Actions
     var entity = db.mycollection.insert(new {name = "John" });
     var result = db.mycollection.findOne(new { name = "John" });
     Console.WriteLine("Result: {0}", result.name);

Features:

  1. Dynamic Collections (work in progress)
  2. Data Types (work in progress). Note: For now only annonymous types are accepted.
  3. DB Actions - Update, Insert, Delete (work in progress)
  4. DB Query - all Finders and Linq (not done)
  5. Extra functionallity from the CSharp Driver (not done)
  6. Multithread - (not done)
  7. More and more...

Notes:

This project is being develop on Mono for Mac using the CSharpDriver Libraries, NUnit and Mono implementation of the C# language. I haven't tested it yet on a windows environment, but this inital commit should work. I used the .NET Framework 4.0

My Blog

dmongo's People

Contributors

felipeg48 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.