BT

InfoQ Homepage News NoRM: Another .NET Provider for MongoDB

NoRM: Another .NET Provider for MongoDB

Bookmarks

NoRM is a .NET library acting as a wrapper around MongoDB, facilitating .NET programming against the mentioned document database. Some of the features are: strongly-typed interface, supporting LINQ, supporting both .NET and Mono.

The main features of the provider are:

  • Providing a strongly-typed interface to MongoDB
  • Supporting most common MongoDB commands
  • Supporting LINQ-to-MongoDB
  • Compatible with .NET and Mono
  • BSON to .NET CLR types back and forth serialization; BSON is the binary-encoded serialization of JSON documents that MongoDB is using

An example of using NoRM (taken from the wiki):

//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();

Another .NET provider for MongoDB is MongoDB-CSharp. According to its author, Steve Wagner, MongoDB-CSharp has been tested on .NET/Windows and Mono 2.0/Ubuntu.

Raven DB, another document database specifically targeting .NET, has been covered by InfoQ when it was released. Unlike MongoDB which is licensed under GNU AGPL v3.0, Raven DB has a free license for open source projects and a paid license for commercial projects.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Disagreed!

    by N C /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I don't think it's fair to say NoRM is "strongly typed" and "supporting LINQ to MongoDB".

    var obj2 = coll.FindOne(new { _id = obj._id}).First();

    The '_id' is an annoymous type, and really offers nothing over doing something like:

    var obj2 = coll.FindOne().AddCriteria("_id", obj._id);

    It would support linq if it was written like:

    var obj2 = coll.FindOne(x => _x._id = obj._id).First();

  • Reporting

    by Sam Corder /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    This article doesn't meet the standards of InfoQ's reporting. It lacks depth or breadth and is not well researched.

  • Re: Disagreed!

    by darren kopp /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    It actually does support linq, the author just didn't show it.

    github.com/atheken/NoRM/tree/master/NoRM.Tests/...

  • Re: Disagreed!

    by N C /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Ah! Thanks for that. I didn't bother investigating since the article didn't go into depth. Didn't see any reason for using this over Simple MongoDB.

  • Re: Reporting

    by Abel Avram /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Sam, there is not much to be said about NoRM. It is just a wrapper. What kind of information did you want to get about it?

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.