BT

NoRM: Another .NET Provider for MongoDB

| by Abel Avram Follow 9 Followers on Jul 10, 2010. Estimated reading time: 1 minute |

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

Tell us what you think

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

Email me replies to any of my messages in this thread

Disagreed! by N C

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

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

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

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

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

Email me replies to any of my messages in this thread

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

Email me replies to any of my messages in this thread

5 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT