Skip to content
atheken edited this page Aug 13, 2010 · 26 revisions

NoRM is a .Net library for connecting to the document-oriented database, MongoDB.

General goals include:

  • Strongly-typed interaction when querying and updating collections.
  • Improved interface to send common Mongo commands (creating indices, getting all the existing dbs and collections, etc.).
  • Ultra-fast de/serialization of BSON to .Net CLR types and back.
  • LINQ-to-Mongo
  • Support for Mono

Getting started with NoRM can be as easy as this:

  //connString is a URI to the database with the credentials you need.
    var coll = (new Mongo(connString)).GetCollection<Product>();
    //create a new object to be added to the collection
    var obj = new Product();
    obj._id = ObjectID.NewObjectID();
    obj.Title = "Shoes";
    //save the object
    coll.Insert(obj);
    //find the object
    var obj2 = coll.FindOne(new { _id = obj._id}).First();

We’ve made some important decisions that you should be aware of:

BSON Serializer — Just as BSON is the core of MongoDB, this is the core of NoRM. In order to provide a powerful serializer, we have rules about what you can & cannot serialize, reading this page will save you a lot of time in debugging.

Flyweight — Because we want to do as much as possible in a strongly-typed way, NoRM is built around the concept of using class definitions as document templates. We realize there will be times when it will be favorable to have arbitrary properties for a given entity. Flyweight helps us to have the best of both worlds.

Interested in contributing but having a hard time getting tests to pass? The Passing Tests page will help you get things setup.

Clone this wiki locally