InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

NoRM: Another .NET Provider for MongoDB

Posted by Abel Avram on Jul 10, 2010

Sections
Architecture & Design,
Development,
Operations & Infrastructure
Topics
.NET ,
NoSQL ,
Data Access

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.

  • This article is part of a featured topic series on NoSQL

Related Sponsor

Neo4j is a robust, high-performance, scalable graph database. It is the only NOSQL database that solves the complex, connected data challenges that enterprises face today.

Disagreed! by N C Posted
Re: Disagreed! by darren kopp Posted
Re: Disagreed! by N C Posted
Reporting by Sam Corder Posted
Re: Reporting by Abel Avram Posted
  1. Back to top

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

  2. Back to top

    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.

  3. Back to top

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

  4. Back to top

    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.

  5. Back to top

    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?

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.