<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>The MongoDB NoSQL Database Blog</title><generator>Tumblr (3.0; @mongodb)</generator><link>http://blog.mongodb.org/</link><item><title>Operations in the New Aggregation Framework</title><description>&lt;i&gt;&lt;p&gt;Available in &lt;a href="http://www.mongodb.org/downloads"&gt;2.1 development release&lt;/a&gt;. Will be stable for production in the &lt;a href="http://www.mongodb.org/display/DOCS/2.2+Release+Notes"&gt;2.2 release&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Built by Chris Westin (&lt;a href="https://twitter.com/#!/cwestin63"&gt;@cwestin63&lt;/a&gt;)&lt;/p&gt;&lt;/i&gt;

&lt;p&gt;MongoDB has built-in
&lt;a href="http://www.mongodb.org/display/DOCS/MapReduce"&gt;MapReduce&lt;/a&gt;
functionality that can be used for complex analytics tasks.  However, we’ve
found that most of the time, users need the kind of group-by functionality that
SQL implementations have.  This can be implemented using map/reduce, but doing
so is more work than it was in SQL.  In version 2.1, MongoDB is introducing a
new &lt;a href="http://www.mongodb.org/display/DOCS/Aggregation+Framework"&gt;
aggregation framework&lt;/a&gt; that will make it much easier to obtain the kind of
results SQL group-by is used for, without having to write custom JavaScript.&lt;/p&gt;

&lt;p&gt;MongoDB provides an easy way to store documents that aren’t just flat records
like SQL, but that also contain arrays and nested documents.  Another common
problem users have told us about is that it can be difficult to manipulate
these sub-parts of documents easily.  The new aggregation mechanism is also
taking on making this easier, by providing operators that can be used to
disassemble and re-assemble document sub-parts.&lt;/p&gt;

&lt;p&gt;After many requests, we have also included expression evaluation to return
computed values—for &lt;i&gt;virtual fields&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;The new aggregation framework is declarative. Rather than writing code to
aggregate data, you specify a chain of operations, called a “pipeline,” to
apply to your documents.  This is similar to a pipe in a unix shell.&lt;/p&gt;

&lt;p&gt;We’re now going to show you a few short examples (using the mongo shell) of
this new functionality to get you started.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;$match&lt;/b&gt; is a pipeline operator that filters out documents that
don’t match the specified condition.  For example
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.runCommand({ aggregate : "article", pipeline : [
    { $match : { author : "dave" } }
]});
&lt;/code&gt;&lt;/pre&gt;
This very simple one step pipeline doesn’t introduce any new functionality yet,
but shows how to put a query at the beginning of your pipeline.  For those of
you familiar with MongoDB, this is the equivalient of
&lt;pre&gt;&lt;code&gt;
&gt; db.article.find({ author : "dave" });
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;b&gt;$project&lt;/b&gt; is a pipeline operator that let’s you select which fields you
want to include or exclude from a result.  You can also create new virtual
fields from computed values.  Here is a simple example, building on the
previous one:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.runCommand({ aggregate : "article", pipeline : [
    { $match : { author : "dave" } },
    { $project : {
        _id : 0,
	author : 1,
        tags : 1
    }}
]});
&lt;/code&gt;&lt;/pre&gt;
As before, this doesn’t introduce anything radically new; this is the
equivalent of
&lt;pre&gt;&lt;code&gt;
&gt; db.article.find({ author : "dave" }, { _id : 0, author : 1, tags : 1);
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;While this functionality was available before from &lt;code&gt;find()&lt;/code&gt;,
what it does demonstrate here is how to put together more than one
aggregation pipeline operator.  The value of &lt;code&gt;pipeline&lt;/code&gt; is an
array consisting of the operators to apply.  Conceptually, the aggregation
framework behaves as if it was feeding the result of scanning the target
collection through that pipeline.&lt;/p&gt;

&lt;p&gt;Now let’s take a look at some new functionality that wasn’t available
before.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;$unwind&lt;/b&gt; hands out the elements of an array one at a time; each element
is surrounded by the document that contains the original array.  For this
example, we’ll first show what a document from the &lt;code&gt;article&lt;/code&gt;
collection looks like.  Suppose we had saved this:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.article.save( {
    title : "this is your title" , 
    author : "dave" , 
    posted : new Date(4121381470000) , 
    pageViews : 7 , 
    tags : [ "fun" , "nasty" ] ,
    comments : [ 
        { author :"barbara" , text : "this is interesting" } , 
        { author :"jenny" , text : "i like to play pinball", votes: 10 } 
    ],
    other : { bar : 14 }
});
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Now, we can unwind the &lt;code&gt;tags&lt;/code&gt; array as follows:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.runCommand({ aggregate : "article", pipeline : [
    { $unwind : "$tags" }
]});
&lt;/code&gt;&lt;/pre&gt;
The result looks like this:
&lt;pre&gt;&lt;code&gt;
{
        "result" : [
                {
                        "_id" : ObjectId("4eeeb5fef09a7c9170df094b"),
                        "title" : "this is your title",
                        "author" : "dave",
                        "posted" : ISODate("2100-08-08T04:11:10Z"),
                        "pageViews" : 7,
                        "tags" : "fun",
                        "comments" : [
                                {
                                        "author" : "barbara",
                                        "text" : "this is interesting"
                                },
                                {
                                        "author" : "jenny",
                                        "text" : "i like to play pinball",
                                        "votes" : 10
                                }
                        ],
                        "other" : {
                                "bar" : 14
                        }
                },
                {
                        "_id" : ObjectId("4eeeb5fef09a7c9170df094b"),
                        "title" : "this is your title",
                        "author" : "dave",
                        "posted" : ISODate("2100-08-08T04:11:10Z"),
                        "pageViews" : 7,
                        "tags" : "nasty",
                        "comments" : [
                                {
                                        "author" : "barbara",
                                        "text" : "this is interesting"
                                },
                                {
                                        "author" : "jenny",
                                        "text" : "i like to play pinball",
                                        "votes" : 10
                                }
                        ],
                        "other" : {
                                "bar" : 14
                        }
                }
        ],
        "ok" : 1
}
&lt;/code&gt;&lt;/pre&gt;
Notice that the single document has been duplicated (see the identical _id
values).  However, the &lt;code&gt;tags&lt;/code&gt; array in each copy of the document
has been replaced with one value from the original &lt;code&gt;tags&lt;/code&gt; array.


&lt;p&gt;$unwind isn’t useful on its own, but is useful when combined with
$match, which can be used to filter out copies of the document without values
of interest, and then the array can be reassembled using other operators such
as $push or $addToSet.  $unwind is also useful when combined with $group.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;$group&lt;/b&gt; groups elements with a common key together, and allows the
application of aggregation functions.  For the purposes of a small example,
let’s add a second article to our collection:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.article.save( {
    title : "this is some other title" , 
    author : "jane" , 
    posted : new Date(978239834000) , 
    pageViews : 6 , 
    tags : [ "nasty" , "filthy" ] ,
    comments : [ 
        { author :"will" , text : "i don't like the color" } , 
        { author :"jenny" , text : "can i get that in green?" } 
    ],
    other : { bar : 14 }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If these articles represent content on a web site, I might want to know
what tags users are applying to these articles.  I can use $group to find
that out like so:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
db.runCommand({ aggregate : "article", pipeline : [
    { $unwind : "$tags" },
    { $group : {
	_id : "$tags",
        count : { $sum : 1 },
	authors : { $addToSet : "$author" }
    }}
]});
&lt;/code&gt;&lt;/pre&gt;
The grouping key for a $group is defined by specifying a field (or subdocument
of multiple fields) for the _id.  The grouping key is used to define buckets
into which documents are put.  Other fields are aggregate functions that can
compute values across the entries in each bucket.


&lt;p&gt;In this case, one is added to &lt;code&gt;count&lt;/code&gt; for each document that
matches the group key.  That counts up the number of items in each bucket.
&lt;code&gt;authors&lt;/code&gt; will be an array, and each unique author in the bucket
will be added to it.&lt;/p&gt;


&lt;p&gt;The result of all this is
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
{
        "result" : [
                {
                        "_id" : "filthy",
                        "count" : 1,
                        "authors" : [
                                "jane"
                        ]
                },
                {
                        "_id" : "fun",
                        "count" : 1,
                        "authors" : [
                                "dave"
                        ]
                },
                {
                        "_id" : "nasty",
                        "count" : 2,
                        "authors" : [
                                "jane",
                                "dave"
                        ]
                }
        ],
        "ok" : 1
}
&lt;/code&gt;&lt;/pre&gt;
One document has the “filthy” tag, and it was written by jane.  One document has
the “fun” tag, and it was written by dave.  Two documents have the “nasty”
tag, and both jane and dave wrote documents with that tag.


&lt;p&gt;The new aggregation functionality is available only by compiling from source. It is available in the &lt;a href="http://www.mongodb.org/downloads"&gt;2.1 development release&lt;/a&gt; but is not meant for production. &lt;a href="http://www.mongodb.org/display/DOCS/2.2+Release+Notes"&gt;MongoDB 2.2&lt;/a&gt; will be the first stable release with the aggregation framework. For
more examples and information, check out the
&lt;a href="http://www.10gen.com/presentations/mongosv-2011/mongodbs-new-aggregation-framework"&gt;talk and demo from MongoSV 2011&lt;/a&gt;, or the
&lt;a href="http://www.mongodb.org/display/DOCS/Aggregation+Framework"&gt;
documentation on the MongoDB wiki&lt;/a&gt;.&lt;/p&gt;


&lt;b&gt;by Chris Westin&lt;/b&gt;</description><link>http://blog.mongodb.org/post/16015854270</link><guid>http://blog.mongodb.org/post/16015854270</guid><pubDate>Tue, 17 Jan 2012 14:04:00 -0500</pubDate></item><item><title>MongoSV Recap</title><description>Last week over 1,100 developers came together for MongoSV, the largest MongoDB conference to date. 10gen kicked off MongoSV with our inaugural &lt;a href="http://blog.10gen.com/post/13885501875/announcing-the-mongodb-masters"&gt;MongoDB Masters program&lt;/a&gt;, which brought together MongoDB evangelists from around the world. 

&lt;p&gt;At the opening keynote, 10gen CTO Eliot Horowitz demoed a &lt;a href="https://github.com/erh/mongosv-twitter-demo"&gt;twitter app&lt;/a&gt; for #mongoSV tweets, featuring the new aggregation framework expected for the MongoDB 2.2 release. These gather all the tweets sent out with the hashtag #mongoSV and organizes them in by recency and most retweets. Get the source code for the demo app &lt;a href="https://github.com/erh/mongosv-twitter-demo"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Highlights from MongoSV include presentations on &lt;a href="http://www.10gen.com/presentations/mongosv-2011/x.commerce-makes-a-big-bet-on-open-source"&gt;X.commerce’s new open source developer platform&lt;/a&gt;, &lt;a href="http://www.10gen.com/presentations/mongosv-2011/hands-on-deploying-mongodb-on-azure"&gt;MongoDB’s integration with Azure&lt;/a&gt;, &lt;a href="http://www.10gen.com/presentations/mongosv-2011/mongodbs-new-aggregation-framework"&gt;MongoDB’s new aggregation framework&lt;/a&gt;, &lt;a href="http://www.10gen.com/presentations/mongosv-2011/a-year-with-mongodb-running-operations-to-keep-the-game-magic-alive"&gt;How Disney manages their deployment of 1400 Mongo instances&lt;/a&gt; and &lt;a href="http://www.10gen.com/presentations#event__mongosv-2011"&gt;more&lt;/a&gt;&lt;/p&gt;


&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lwb69nTtFV1qzyevi.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lwb64l1wki1qzyevi.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lw658bdaNQ1qzyevi.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lw658h2E3C1qzyevi.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;
the 10gen booth at MongoSV
&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lw658588fy1qzyevi.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;
10gen President Max Schireson welcomes the Speakers and Masters to MongoSV</description><link>http://blog.mongodb.org/post/14318434522</link><guid>http://blog.mongodb.org/post/14318434522</guid><pubDate>Fri, 16 Dec 2011 14:57:00 -0500</pubDate><category>mongoSV</category><category>MongoDB</category><category>conference</category><category>databases</category><category>database</category><category>noSQL</category></item><item><title>MongoDB On Microsoft Azure</title><description>&lt;p&gt;A new preview release of the MongoDB controller for Azure is available. This release includes support for replica sets, and over the coming months, we’ll be adding support for MongoDB’s sharding facilities. We’ll also be working to more tightly integrate MongoDB with the features of Azure platform.&lt;/p&gt;

&lt;p&gt;Each member of a replica set is hosted by an instance of an Azure worker role, so the size of the replica set is determined by the number of instances configured for the the replica set worker roles. Each replica set worker role creates a child process to run the mongod server process.&lt;/p&gt;

&lt;p&gt;The controller defines an Azure worker role which represents a MongoDB cluster.  Currently the cluster consists of a single MongoDB replica set.  Each role instance participates as a member of the replica set. On deployment the controller configures the replica set and initiates it. Role instances handle restarts, including assuming identity for a replica set member and replacing old instances. The worker role also integrates with Azure Diagnostics to capture trace and performance counter information.&lt;/p&gt;

&lt;p&gt;The MongoDB Azure wrapper release is currently delivered as a Visual Studio 2010 solution with associated source files, and we’ll follow that up in the future with packaging and deployment tools. To get started, take a look at the &lt;a href="http://www.mongodb.org/display/DOCS/MongoDB+on+Azure"&gt;documentation&lt;/a&gt; or browse through the &lt;a href="https://github.com/mongodb/mongo-azure"&gt;source&lt;/a&gt;. We’ve included a small sample application to get you up and running quickly. If you have questions, head over to our &lt;a href="https://groups.google.com/group/mongodb-user/"&gt;user mailing list&lt;/a&gt; or file a bug report on our &lt;a href="https://jira.mongodb.org/browse/AZURE"&gt;JIRA&lt;/a&gt; system. &lt;/p&gt;

&lt;p&gt;Microsoft will be presenting at the &lt;a href="http://www.10gen.com/events/mongosv-2011"&gt;MongoSV&lt;/a&gt; conference in Santa Clara on December 9th. It will be a great opportunity to understand the solution in depth, as well as understand the future direction of this project. We hope to see you there.&lt;/p&gt;</description><link>http://blog.mongodb.org/post/13594969869</link><guid>http://blog.mongodb.org/post/13594969869</guid><pubDate>Thu, 01 Dec 2011 12:54:00 -0500</pubDate></item><item><title>MongoDB Monitoring Service Docs Available</title><description>&lt;p&gt;&lt;a href="https://mms.10gen.com/user/register?c=blog"&gt;MongoDB Monitoring Service&lt;/a&gt; (MMS) documentation now available: &lt;a href="http://mms.10gen.com/help/"&gt;&lt;a href="http://mms.10gen.com/help/"&gt;http://mms.10gen.com/help/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.mongodb.org/post/12290838151</link><guid>http://blog.mongodb.org/post/12290838151</guid><pubDate>Thu, 03 Nov 2011 14:53:48 -0400</pubDate></item><item><title>Mongo Boston Recap</title><description>&lt;p&gt;Last week 250 developers converged at the Microsoft New England Research and Design Center for &lt;a href="http://www.10gen.com/events/mongo-boston-2011"&gt;Mongo Boston&lt;/a&gt;. Highlights from the event include presentations on &lt;a href="http://www.10gen.com/presentation/mongoboston-2011/welcome-and-whats-new-in-mongodb-2.0"&gt;MongoDB 2.0&lt;/a&gt;, &lt;a href="http://www.10gen.com/presentation/mongoboston-2011/how-mtv-leverages-mongodb-for-cms"&gt;how MTV leverages MongoDB for CMS&lt;/a&gt;,  &lt;a href="http://www.10gen.com/presentation/mongoboston-2011/cowboy-coding-learn-when-and-how-to-break-all-the-rules-for-really-rapid-prototyping"&gt;rapid prototyping&lt;/a&gt;, and &lt;a href="http://www.10gen.com/presentations#event__mongoboston-2011"&gt;more&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.flickr.com/photos/49439061@N04/6221048217/" title="074_DP_5132 by mongodb, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6172/6221048217_500d2fc963.jpg" width="500" height="333" alt="074_DP_5132"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;i&gt;More photos from the event are available on the &lt;a href="http://www.flickr.com/photos/49439061@N04/sets/72157627716787783/with/6221048217/"&gt;MongoDB Flickr&lt;/a&gt; page.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;If you missed the event, join the &lt;a href="http://www.meetup.com/Boston-MongoDB-User-Group/events/35018592/"&gt;Boston MongoDB User Group&lt;/a&gt;, which also meets at NERD. The next meeting is on November 15.&lt;/p&gt;</description><link>http://blog.mongodb.org/post/11321480271</link><guid>http://blog.mongodb.org/post/11321480271</guid><pubDate>Tue, 11 Oct 2011 13:42:56 -0400</pubDate></item><item><title>2.0 Presentation at New York MongoDB User Group</title><description>&lt;p&gt;On Thursday MongoDB core committer Eliot Horowitz presented to the &lt;a href="http://www.meetup.com/New-York-MongoDB-User-Group/"&gt;New York MongoDB User Group&lt;/a&gt; on the latest features in v2.0. The event was hosted by &lt;a href="https://www.sailthru.com/"&gt;Sailthru&lt;/a&gt;, a MongoDB-powered startup doing intelligent email marketing. The meetup was announced Monday night and within a day was oversubscribed. After the presentation, we all went out for drinks to celebrate the release.
&lt;br/&gt;&lt;br/&gt;
The NY MUG has over 1,000 members and meets monthly. There are also MongoDB user groups in &lt;a href="http://www.meetup.com/San-Francisco-MongoDB-User-Group/"&gt;San Francisco&lt;/a&gt;, &lt;a href="http://www.meetup.com/Washington-DC-MongoDB-Users-Group/"&gt;Washington DC&lt;/a&gt;, &lt;a href="http://www.meetup.com/London-MongoDB-User-Group/"&gt;London&lt;/a&gt;, &lt;a href="http://www.meetup.com/Boston-MongoDB-User-Group"&gt;Boston&lt;/a&gt;, &lt;a href="http://groups.google.com/group/mongodb-jp"&gt;Japan&lt;/a&gt;, and &lt;a href="http://www.mongodb.org/display/DOCS/MongoDB+User+Groups+%28MUGs%29"&gt;more&lt;/a&gt;. And if there isn’t a MongoDB meetup in your city, we’re happy to support you if you would like to &lt;a href="http://www.10gen.com/user-groups#Start"&gt;start one&lt;/a&gt;.
&lt;br/&gt;&lt;br/&gt;
In case you missed the meetup, video and photos are posted below. Enjoy!
&lt;br/&gt;&lt;br/&gt;&lt;object id="flashObj" width="480" height="270" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0"&gt;&lt;param name="movie" value="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&amp;isUI=1"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="flashVars" value="@videoPlayer=1170761477001&amp;playerID=596005226001&amp;playerKey=AQ~~,AAAAipOTmrk~,ppF_qxBkWm4G-M_tDdbW6qnuU4iUxLyo&amp;domain=embed&amp;dynamicStreaming=true"&gt;&lt;param name="base" value="http://admin.brightcove.com"&gt;&lt;param name="seamlesstabbing" value="false"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="swLiveConnect" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://c.brightcove.com/services/viewer/federated_f9?isVid=1&amp;isUI=1" bgcolor="#FFFFFF" flashvars="@videoPlayer=1170761477001&amp;playerID=596005226001&amp;playerKey=AQ~~,AAAAipOTmrk~,ppF_qxBkWm4G-M_tDdbW6qnuU4iUxLyo&amp;domain=embed&amp;dynamicStreaming=true" base="http://admin.brightcove.com" name="flashObj" width="480" height="270" seamlesstabbing="false" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" swliveconnect="true" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;br/&gt;&lt;br/&gt;&lt;img src="http://farm7.static.flickr.com/6067/6154093700_6b58849a3b.jpg" width="469" height="500" alt="Q9159035"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://farm7.static.flickr.com/6165/6154098556_30927f936a.jpg" width="500" height="282" alt="Q9159065"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://farm7.static.flickr.com/6191/6154097014_08f56cdf69.jpg" width="500" height="321" alt="Q9159058"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://farm7.static.flickr.com/6203/6153567847_3c262d12f6.jpg" width="500" height="402" alt="Q9159190"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://farm7.static.flickr.com/6160/6153564149_25c531c21b.jpg" width="500" height="391" alt="Q9159136"/&gt;&lt;/p&gt;</description><link>http://blog.mongodb.org/post/10450332040</link><guid>http://blog.mongodb.org/post/10450332040</guid><pubDate>Tue, 20 Sep 2011 15:46:32 -0400</pubDate></item><item><title>Cache Reheating - Not to be Ignored</title><description>An important aspect to keep in mind with databases is the cost of cache reheating after a server restart.  Consider the following diagram which shows several cache servers (e.g., memcached) in front of a database server.
&lt;p&gt;

&lt;img src="http://media.tumblr.com/tumblr_lrkzxcKo0g1qzyevi.png"/&gt;&lt;/p&gt;&lt;p&gt;

This sort of setup is common and can work quite well when appropriate; it removes read load from the database and allows more RAM to be utilized for scaling (when the database doesn’t scale horizontally).  But what happens if all the cache servers restart at the same time, say, on a power glitch in a data center?
&lt;/p&gt;&lt;p&gt;

We then have a cache reheating scenario.  After the bounce the full load of all read requests will hit the database server (for a while) given the caches are empty.  The server won’t be able to handle it (that’s why the cache servers were there in the first place).  Now if the reheat time is short, this is not a big problem : we did go down after all.  But if reheat takes a long time, it’s a big problem.  Imagine 20 cache servers with 64GB RAM each.  1.2 terabytes of data must be queried from the database to be fully reheated!
&lt;/p&gt;&lt;p&gt;

Even without a cache server, the same issue exists for almost all databases. Imagine a server restart on a system with 64GB RAM.  If loading 100MB/sec, reheat will take 10 minutes.  However, if the queries are coming in randomly, it could take much much longer — only with sequential I/O can we get anywhere near that speed.
&lt;/p&gt;&lt;p&gt;

One could just sequentially read data in and fill the cache.  However for databases much larger than RAM, loading in the right portion is difficult.  “Hot” data could be at very different locations in the terabyte(s) of on disk data.
&lt;/p&gt;&lt;p&gt;

A very nice attribute of the MongoDB storage engine is its use of memory-mapped files.  In this model the cache is the operating system’s file system cache.  Restart the mongod process, and there is no reheat issue at all.  Some databases use their own page cache which causes a reheat scenario even on just a process restart. Of course on a full server reboot MongoDB must reheat too.
&lt;/p&gt;&lt;p&gt;
A few points to keep in mind:

&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Think about reheating and how you will operationally handle it if a scenario involving it occurs.
For schedules OS maintenance restart the server during off peak hours to minimize the load during reheat.&lt;/li&gt;
&lt;li&gt;Restarting the mongod process is safe with respect to reheating.&lt;/li&gt;
&lt;li&gt;Remounting a volume likely loses all file system cache info for the volume.&lt;/li&gt;
&lt;li&gt;On a server restart, copy datafiles to /dev/null to force reheating to be sequential and thus much faster.  This can be done even if the mongod process is already running.  If the database is larger than RAM, copy only the newest datafiles (ones with the highest numbers); while this isn’t perfect, the latest files likely contain the largest percentage of frequently used data.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://blog.mongodb.org/post/10407828262</link><guid>http://blog.mongodb.org/post/10407828262</guid><pubDate>Mon, 19 Sep 2011 13:56:05 -0400</pubDate></item><item><title>MongoDB 2.0 Released</title><description>&lt;p&gt;&lt;span&gt;The MongoDB development team is pleased to announce the release of version 2.0.0.  Version 2.0 is the latest stable release, following the March 2011 release of version 1.8.  This release includes many new features, improvements to existing features, and performance enhancements.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please note version 2.0 is a significant new release, but is 2.0 solely because 1.8 + 0.2 = 2.0; for example the upgrade from 1.6 to 1.8 was similar in scope.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Highlights of the 2.0 release:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;span&gt;&lt;a href="http://www.google.com/url?q=http%3A%2F%2Fwww.mongodb.org%2Fdisplay%2FDOCS%2F2.0%2BRelease%2BNotes%232.0ReleaseNotes-ConcurrencyImprovements&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNFPuopL1dnlbfMt-m9gRDHwo6Nvag"&gt;Concurrency improvements&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes#2.0ReleaseNotes-IndexPerformanceEnhancements"&gt;Index enhancements to improve size and performance&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-ReplicaSetandShardingAuthentication"&gt;Authentication with sharded clusters&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes#2.0ReleaseNotes-Datacenterawareness"&gt;Replica Set Data Center Awareness&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Journaling"&gt;Journaling&lt;/a&gt;&lt;/span&gt;&lt;span&gt; is now enabled by default.  Journal files are now compressed.&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/getLastError+Command"&gt;User defined getLastError options&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes#2.0ReleaseNotes-DefaultStackSize"&gt;Smaller default stack size to accommodate more connections&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/compact+Command"&gt;Compact Command&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes#2.0ReleaseNotes-GeospatialFeatures"&gt;Geo-spatial features&lt;/a&gt;&lt;/span&gt;
    &lt;ul&gt;&lt;li&gt;&lt;span&gt;Multi-location documents&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;span&gt;Polygon searches&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes#2.0ReleaseNotes-Outputtoashardedcollection"&gt;Output map/reduce results to sharded collection&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;span&gt;Concurrency improvements in 2.0 are just the start of a much larger concurrency roadmap we are working on.  In 2.0, we are beginning to address one of the biggest issues: holding locks during a page fault.  2.0 tracks memory caching and has the ability to yield locks and fault outside.  This is hooked in a number places, notably: updates by _id, remove, and long table scans.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Being able to keep the working index set in memory is an important factor in overall performance, and we overhauled indexes to make this easier.  Indexes in 2.0 are about 25% smaller and faster, meaning that you can fit more in memory.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Replica sets get two new important features in 2.0: priorities and tagging.  Priorities let you have nodes that you prefer to be primary if you have a non homogeneous environment.  Tagging lets you guarantee writes hit certain groups of servers.  One use case for this is guaranteeing a new user registration is written to two data centers before acknowledging to a user.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;There were many other improvements, so we encourage those interested to look at the change log.  Overall, this release added a large number of small performance and concurrency improvements, greater stability to sharding, and better replica set operations.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Downloads: &lt;/span&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/downloads"&gt;&lt;a href="http://www.mongodb.org/downloads"&gt;http://www.mongodb.org/downloads&lt;/a&gt;&lt;/a&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Release Notes: &lt;/span&gt;&lt;span&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes"&gt;&lt;a href="http://www.mongodb.org/display/DOCS/2.0+Release+Notes"&gt;http://www.mongodb.org/display/DOCS/2.0+Release+Notes&lt;/a&gt;&lt;/a&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Full change log: &lt;a href="https://jira.mongodb.org/secure/IssueNavigator.jspa?requestId=10140"&gt;https://jira.mongodb.org/secure/IssueNavigator.jspa?requestId=10140&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For the full scoop on what’s new in MongoDB version 2.0, register for our live webinar on Thursday, September 15th. We will have two sessions: the first at &lt;a href="http://www.10gen.com/events/mongodb-version-2dot0-s1"&gt;10am GMT&lt;/a&gt;, and another at &lt;a href="http://www.10gen.com/events/mongodb-version-2dot0-s2"&gt;1:30pm ET/10:30am PT&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you to the MongoDB community for your continued feedback and testing through the 1.9 development series.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span&gt;-Eliot and the MongoDB Team&lt;/span&gt;&lt;/p&gt;</description><link>http://blog.mongodb.org/post/10126837729</link><guid>http://blog.mongodb.org/post/10126837729</guid><pubDate>Mon, 12 Sep 2011 11:32:22 -0400</pubDate></item><item><title>BSON and Data Interchange</title><description>&lt;p&gt;There’s a lot of good things about JSON — it’s a standards based, language independent, representation of object-like data.  Also, it’s easy to read (for users and programmers alike).  Each document is only about data, not complex object graphs and links.  Thus it’s easy to inspect without knowing all the code of an application.
&lt;br/&gt;&lt;br/&gt;
Further, JSON is “schemaless”.  We do not have to predefine our (protocol) schema.  This can be quite helpful: imagine RPC’ing data from client A to server B with a fixed schema for the messages.  On a schema change both need to be ‘updated’ with the new schema.  If there are many components to the system it’s even more complicated of course.  There is some analogy here to XML, which can (optionally) be schemaless.
&lt;br/&gt;&lt;br/&gt;
It would be nice to have a binary representation of JSON. That is what &lt;a href="http://bsonspec.org/"&gt;BSON&lt;/a&gt; is all about.  
&lt;br/&gt;&lt;br/&gt;
So what are the goals of BSON?  They are: 
&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Fast scan-ability.&lt;/b&gt;  For very large JSON documents, scanning can be slow.  To skip a nested document or array we have to scan through the intervening field completely.  In addition as we go we must count nestings of braces, brackets, and quotation marks.  In BSON, the size of these elements is at the beginning of the field’s value, which makes skipping an element easy.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Easy manipulation.&lt;/b&gt; We want to be able to modify information within a document efficiently.  For example, incrementing a field’s value from 9 to 10 in a JSON text document might require shifting all the bytes for the remainder of the document, which if the document is large could be quite costly.   (Albeit this benefit is not comprehensive: adding an element to an array mid-document would result in shifting.)  It’s also helpful to not need to translate the string “9” to a numeric type, increment, and then translate back. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;Additional data types.&lt;/b&gt;  JSON is potentially a great interchange format, but it would be nice to have a a few more data types.  Most importantly is the addition of a “byte array” data type.  This avoids any need to do base64 encoding, which is awkward.&lt;/li&gt;
&lt;/ol&gt;&lt;br/&gt;
One thing that is not a goal of BSON: compactness.  The JSON document {“field”:7} represents the number seven as a single byte.  That’s pretty good.
&lt;br/&gt;&lt;br/&gt;
Perhaps the best example to date of usage of BSON is MongoDB.  MongoDB uses it heavily —  for sending documents over the network, persisting them to disk, as well as for internal data manipulations.  In fact this is where BSON originated, although today it is a separate spec that should not be considered coupled to any one particular project.
&lt;br/&gt;&lt;br/&gt;
There is BSON serialization and deserialization code for most languages; implementations are open source and mostly available under Apache 2 license.  Quite a few implementations originated from a MongoDB drivers; work is underway in most drivers to fully decouple, although independent use works fine today.
&lt;br/&gt;&lt;br/&gt;
If you or someone you know is using BSON in a project, please let us know by posting on the &lt;a href="http://groups.google.com/group/bson"&gt;BSON mailing list&lt;/a&gt;.  Check out &lt;a href="http://bsonspec.org/"&gt;bsonspec.org&lt;/a&gt; for more information.
&lt;br/&gt;&lt;br/&gt;
— &lt;a href="http://twitter.com/#!/stbrody"&gt;Spencer&lt;/a&gt; &amp; &lt;a href="http://twitter.com/#!/dmerr"&gt;Dwight&lt;/a&gt;</description><link>http://blog.mongodb.org/post/9333386434</link><guid>http://blog.mongodb.org/post/9333386434</guid><pubDate>Wed, 24 Aug 2011 09:52:00 -0400</pubDate></item><item><title>Master Detail Transactions in MongoDB</title><description>&lt;p&gt;In relational databases, transactions let you make reliable atomic updates to your data. Because relational schemas are often highly normalized, most logical transactions span multiple tables, so it is important to be able to do multiple updates atomically (all or nothing).&lt;/p&gt;

&lt;p&gt;While MongoDB does not have multi-document transactions, it makes up for this in many use cases through its document oriented data model. In this post, we’ll talk about the Master-Detail design pattern that comes up very often in data modelling that almost always requires multi-statement transactions in an RDBMS, but is easily handled without cross-statement transactions in MongoDB. &lt;/p&gt;

&lt;h3&gt;Master-Detail transactions in an RDBMS&lt;/h3&gt;

&lt;p&gt;As an example of the Master-Detail pattern, consider a Purchase Order with multiple line items. In an RDBMS, we might model this as a Purchase Order table (the Master) and a Line Item table (the Detail). To get a purchase order, I need to join Purchase Order and Line Item tables together to get all of the info in the purchase order. &lt;/p&gt;

&lt;p&gt;I might model my Purchase Orders as follows in an RDBMS: &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=po_schema.sql"&gt;&lt;/script&gt;&lt;p&gt;If I want to make atomic updates to a purchase order and its line items, I need a multi-statement transaction. For example, if I am going to create a purchase order, I might follow these steps: &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=insert_po.sql"&gt;&lt;/script&gt;&lt;p&gt;With this update, there is never a time where the Purchase Order exists but has no Line Items in it. The whole object and its details are committed in a single transaction. &lt;/p&gt;

&lt;p&gt;Now if I need to update that Purchase Order, say to add a few more line items, then I would  perform another transaction. &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=update_po.sql"&gt;&lt;/script&gt;&lt;p&gt;This time I’ve ensured that my two new Line Items appear at the same time (or not at all) and that the total field of the Purchase Order is updated at the same time. No client will ever see a state in which only one of those Line Items exists nor any state where the total does not match the sum of the line items. &lt;/p&gt;

&lt;h3&gt;Master-Detail in MongoDB&lt;/h3&gt;
 
&lt;p&gt;Working with MongoDB is a bit different. While we don’t have the ability to perform multi-documents transactions (at least so far).  However this Master-Detail pattern can be handled without multi-statement transactions thanks to MongoDB’s richer data model. &lt;/p&gt;

&lt;p&gt;MongoDB can store data as documents with nested objects, arrays, and other rich data types.  Thus we don’t need to store Master-Detail entities in multiple collections, or even in more than one document. A common way of modeling such objects with MongoDB is using nested documents. So our Purchase Order model might look like this: &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=po_document.js"&gt;&lt;/script&gt;&lt;p&gt;Let’s look at how we can get the same level of atomicity from MongoDB without needing multi-statement transactions! &lt;/p&gt;

&lt;p&gt;First, we want to be able to create a new purchase order and its first line items atomically. &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=po_insert.js"&gt;&lt;/script&gt;&lt;p&gt;This atomically creates the purchase order and its initial items in a single operation. Just as with the SQL scenario, clients will never see a point in time where the purchase order is empty. It all succeeds in a single step. &lt;/p&gt;

&lt;p&gt;Now what about modifying that purchase order? If we want to add some items to the PO, we can do so like this: &lt;/p&gt;

&lt;script src="https://gist.github.com/1068265.js?file=po_update.js"&gt;&lt;/script&gt;&lt;p&gt;The $pushAll operator atomically appends values onto an array attribute. Just as with our RDBMS scenario, this update is atomic and the whole command either succeeds or fails. Meanwhile the $inc operator atomically increments the “total” field of the purchase order. All of these updates happen atomically and they succeed or fail as a group so another client will never see an inconsistent state of the order. &lt;/p&gt;

&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;It turns out that most of the time where you find yourself with a Master-Detail pattern in an RDBMS, you can achieve the same level of consistency in MongoDB by modelling your object as a rich, nested document, rather than multiple joined tables. Combine this with MongoDB’s atomic update operators, and you can solve most of what you would traditionally do with multi-statement transactions in an RDBMS. &lt;/p&gt;

&lt;p&gt;An RDBMS needs multi-statement transactions for these scenarios because the only way it has to model these types of objects is with multiple tables. By contrast, MongoDB can go much further with single-statement transactions because there’s no need to join on simple updates like this. &lt;/p&gt;

&lt;p&gt;This is not to say that multi-statement transactions are not useful. If you need to perform cross-entity transactions (e.g. move a line item from one purchase order to another) or if you need to modify a purchase order and inventory objects in a single step, then you may still need &lt;a href="http://www.mongodb.org/display/DOCS/two-phase+commit"&gt;multi-statement transactions&lt;/a&gt;.  Or else you would have to take some &lt;a href="http://eaipatterns.com/ramblings/18_starbucks.html"&gt;alternate approach&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But it turns out that many of the cases where we traditionally need multi-statement transactions go away when we can model objects as documents and perform atomic updates on those documents. &lt;/p&gt;

&lt;p&gt;Another aspect of transactions and ACID is isolation. MongoDB does not support fully generalized snapshotting. We haven’t discussed that here; it’s probably a good topic for another blog post in the future.&lt;/p&gt;

— &lt;a href="http://jaredrosoff.com"&gt;Jared Rosoff&lt;/a&gt; (&lt;a href="http://twitter.com/forjared"&gt;@forjared&lt;/a&gt;)</description><link>http://blog.mongodb.org/post/7494240825</link><guid>http://blog.mongodb.org/post/7494240825</guid><pubDate>Mon, 11 Jul 2011 11:17:00 -0400</pubDate></item><item><title>Design of the Erlang Driver for MongoDB</title><description>&lt;p&gt;Since November 2010, I have been writing an &lt;a href="https://github.com/TonyGen/mongodb-erlang"&gt;Erlang driver for MongoDB&lt;/a&gt;. After many months of work, I would consider the driver production-ready, and wanted to take this opportunity to introduce the driver and highlight a few of the design decisions. For detailed documentation with code examples please see the links at the end of this article.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;BSON&lt;/b&gt;&lt;br/&gt;
At the highest level, the driver is divided into two library applications, &lt;a href="https://github.com/TonyGen/mongodb-erlang"&gt;mongodb&lt;/a&gt; and &lt;a href="https://github.com/TonyGen/bson-erlang"&gt;bson&lt;/a&gt;. BSON is defined independently of MongoDB at &lt;a href="http://bsonspec.org/"&gt;bsonspec.org&lt;/a&gt;. One design decision was how to represent BSON documents in Erlang. Conceptually, a document is a record, but unlike an Erlang record, a BSON document does not have a single type tag. Furthermore, the same MongoDB collection can hold different types of records. So I decided to represent a BSON document as a tuple with labels interleaved with values, as in 

&lt;code&gt;{name, &lt;&lt;"Tony"&gt;&gt;, city, &lt;&lt;"New York"&gt;&gt;}&lt;/code&gt;.

An alternative would have been to represent a document as a list of label-value pairs, but I wanted to reserve lists for BSON arrays.
&lt;br/&gt;&lt;br/&gt;
A BSON value is one of several types. One of these types is the document type itself, making it recursive. Several value types are not primitive, like objectId and javascript, so I had to define a tagged tuple type for each of them. I defined them all to have an odd number of elements to distinguish them from a document which has an even number of elements. For example, a javascript value looks like &lt;code&gt;{javascript, {x,2}, &lt;&lt;"x + 1"&gt;&gt;}&lt;/code&gt;.  Finally, to distinguish between a string and a list of integers, which is indistinguishable in Erlang, I require BSON strings to be binary (UTF-8). Therefore, a plain Erlang string is interpreted as a BSON array of integers, so make sure to always encode your strings, as in 

&lt;code&gt; &lt;&lt;"hello"&gt;&gt; &lt;/code&gt; or &lt;code&gt;bson:utf8("hello")&lt;/code&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Var&lt;/b&gt;&lt;br/&gt;
The mongodb driver has a couple of objects like connection and cursor that maintain mutable state. The only way to mutate state in Erlang is to have a process that maintains its own state that it updates when it receives messages from other processes. The Erlang programmer typically creates a process for each mutable object and defines the messages it may receive and the action to take for each message. They usually provide helper functions for the clients to call that hide the actual messages being sent and returned. Erlang OTP provides a small framework called &lt;i&gt;gen_server&lt;/i&gt; to facilitate this process definition but it is still non-trivial. To alleviate this burden I created another abstraction on top of gen_server called &lt;i&gt;var&lt;/i&gt;. A var is an object (process) that holds a value of some type A that may change. Its basic operation is 
&lt;code&gt;modify (var(A), fun ((A) -&gt; {A, B})) -&gt; B&lt;/code&gt; 
which applies the function to the current value of the var then changes the var’s value to the first item of the result while returning the second item of the result to the client. This is done atomically thanks to the sequential nature of Erlang processes. The function may perform side effects (sending/receiving messages or doing IO), in which case the var acts like a mutex since only one function can execute against the var at a time. In essence, using var or even just gen_server changes the programming paradigm from message passing to protected shared state, which is more like Haskell for example.
&lt;br/&gt;&lt;br/&gt;
With &lt;code&gt;var&lt;/code&gt; it is now very easy to create objects that protect a shared resource or have internal mutable state. A TCP connection to a MongoDB server is one such resource that needs protection. The connection object in mongodb is implemented as a var holding a TCP connection. Every read and write operation gets exclusive access to the TCP connection when sending and receiving its messages to and from the server. This allows multiple user processes to read and write to the same mongodb connection concurrently.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;DB Action&lt;/b&gt;&lt;br/&gt;
Every read/write operation may throw a DB exception. Furthermore, every read/write operation requires a DB context that includes the connection to use, the database to access, whether slave is ok (read_mode), and whether to confirm writes (write_mode). We group a series of read/write operations that perform a single high-level task into a function called a &lt;i&gt;DB action&lt;/i&gt;. We then execute the action within a single exception handler and with a single DB context in dynamic scope (using Erlang’s process dictionary). 

&lt;code&gt;mongo:do (write_mode(), read_mode(), connection(), db(), action(A)) -&gt; {ok, A} | {failure, failure()}&lt;/code&gt;  

sets up the context, runs the action, and catches and returns any DB failure. Note, it will not catch and return other types of exceptions like programming errors.
&lt;br/&gt;&lt;br/&gt;
You may notice that a DB action is analogous to a DB transaction for a relational database in that the action aborts when one of its operations fails. However, for scalability reasons, MongoDB does not support ACID across multiple read/write operations, so the operations before the failed operation remain in effect. Your failure handler must be prepared to recover from this intermediate state. If your DB action is conceptually a single high-level task, then it should not be too hard to undo and redo that task even from an intermediate state.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Documentation&lt;/b&gt;&lt;br/&gt;
Detailed documentation with examples can be found in the ReadMe’s of the two libraries, &lt;a href="https://github.com/TonyGen/mongodb-erlang"&gt;mongodb&lt;/a&gt; and &lt;a href="https://github.com/TonyGen/bson-erlang"&gt;bson&lt;/a&gt;, and in their source code comments and test modules.
&lt;br/&gt;&lt;br/&gt;
- &lt;a href="mailto:tony@10gen.com"&gt;Tony Hannan&lt;/a&gt;&lt;/p&gt;</description><link>http://blog.mongodb.org/post/7270427645</link><guid>http://blog.mongodb.org/post/7270427645</guid><pubDate>Tue, 05 Jul 2011 14:27:00 -0400</pubDate></item><item><title>Getting started with VMware CloudFoundry, MongoDB and Node.js</title><description>&lt;i&gt;Listen to the recording of the &lt;a href="http://www.10gen.com/webinars/nodejs"&gt;Node.js Panel Discussion webinar&lt;/a&gt;.&lt;/i&gt;

&lt;div id="overview"&gt;
&lt;p&gt;&lt;b&gt; Overview&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Following up from our &lt;a href="http://blog.mongodb.org/post/4719358003"&gt;previous post&lt;/a&gt; we’re posting up a quick how-to for using &lt;a href="http://nodejs.org"&gt;Node.JS&lt;/a&gt;, &lt;a href="http://www.cloudfoundry.com"&gt;CloudFoundry&lt;/a&gt; and &lt;a href="http://www.mongodb.org"&gt;MongoDB&lt;/a&gt; together.&lt;/p&gt;

&lt;p&gt;Our end goal here is to build a simple web app that records visits and provides a reporting screen for the last 10 visits.&lt;/p&gt;
&lt;/div&gt;

&lt;div id="tools_we_need"&gt;
&lt;p&gt;&lt;b&gt; Tools We Need&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;&lt;a href="http://cloudfoundry.com/signup"&gt;Sign up for a Cloud Foundry account&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mongodb.org/display/DOCS/Quickstart"&gt;Local installation of MongoDB&lt;/a&gt; &amp; &lt;a href="https://github.com/joyent/node/wiki/Installation"&gt;Node.JS&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; Cloud Foundry &lt;a href="http://support.cloudfoundry.com/entries/20012337-getting-started-guide-command-line-vmc-users"&gt;VMC tools&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; All of the code is available on &lt;a href="https://github.com/gatesvp/cloudfoundry_node_mongodb"&gt;github&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
Follow the links to install &amp; configure the various tools.
&lt;/div&gt;

&lt;div id="getting_started"&gt;
&lt;p&gt;&lt;b&gt; Getting Started&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;&lt;li&gt; Start the &lt;code&gt;mongod&lt;/code&gt; process on your local computer. Use the default port.&lt;/li&gt;
&lt;li&gt; Confirm that node.js is correctly installed. You should be able to run &lt;code&gt;node&lt;/code&gt; from the command-line and receive a basic javascript shell. You should also have NPM (node package manager) installed.&lt;/li&gt;
&lt;li&gt; Make a directory for the project and then ensure that CloudFoundry is correctly configured. Mine looked as follows:&lt;/li&gt;
&lt;/ol&gt;&lt;pre&gt;
mongo@ubuntu:~$ sudo gem install vmc
mongo@ubuntu:~$ vmc target api.cloudfoundry.com
Succesfully targeted to [http://api.cloudfoundry.com]

mongo@ubuntu:~$ vmc login
Email: gates@10gen.com
Password: ********
Successfully logged into [http://api.cloudfoundry.com]
&lt;/pre&gt;
&lt;/div&gt;

&lt;div id="step_1"&gt;
&lt;p&gt;&lt;b&gt; Step 1: Hello world&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;In your directory create a file called &lt;a href="https://github.com/gatesvp/cloudfoundry_node_mongodb/blob/master/app.js.1"&gt;&lt;code&gt;app.js&lt;/code&gt;&lt;/a&gt;. In that file, type the following code. This will create a basic web server on localhost:3000 or on the assigned host:port combination on the CloudFoundry server.&lt;/p&gt;

&lt;pre&gt;
var port = (process.env.VMC_APP_PORT || 3000);
var host = (process.env.VCAP_APP_HOST || 'localhost');
var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(port, host);
&lt;/pre&gt;

&lt;p&gt;Test our file locally:&lt;/p&gt;

&lt;pre&gt;
$ node app.js
$ curl localhost:3000
Hello World
# kill node with CTRL+C
&lt;/pre&gt;

&lt;p&gt;Push our file to CloudFoundry and test. CloudFoundry automatically picks up that we’re using node.js,but it will ask some other configuration questions, including a name and the services we want to have running. I have named mine &lt;code&gt;gvp_node_test&lt;/code&gt; and requested that MongoDB be run as a service.&lt;/p&gt;

&lt;p&gt;The commands &amp; output:&lt;/p&gt;

&lt;pre&gt;
$ vmc push 
Would you like to deploy from the current directory? [Yn]: Y
Application Name: gvp_node_test
Application Deployed URL: 'gvp_node_test.cloudfoundry.com'? 
Detected a Node.js Application, is this correct? [Yn]: Y
Memory Reservation [Default:64M] (64M, 128M, 256M, 512M, 1G or 2G) 
Creating Application: OK
Would you like to bind any services to 'gvp_node_test'? [yN]: y
The following system services are available::
1. mongodb
2. mysql
3. redis
Please select one you wish to provision: 1
Specify the name of the service [mongodb-55516]: 
Creating Service: OK
Binding Service: OK
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK   
Push Status: OK
Staging Application: OK                                                         
Starting Application: OK                                       
&lt;/pre&gt;

&lt;p&gt;
At this point you should have a simple working web app. Note the URL: &lt;code&gt;your_app_name.cloudfoundry.com&lt;/code&gt;, we can test it is working with &lt;code&gt;curl&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
$ curl your_app_name.cloudfoundry.com
Hello World
&lt;/pre&gt;
&lt;/div&gt;

&lt;div id="step_2"&gt;
&lt;p&gt;&lt;b&gt; Step 2: getting mongo configs &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;CloudFoundry has now configured a MongoDB service with its own user name, password, ip and port. To access these on the server, we will need to parse the environment variables coming into the &lt;code&gt;node&lt;/code&gt; process.&lt;/p&gt;

&lt;p&gt;To do this we do the following, note that we’ve added an &lt;code&gt;else&lt;/code&gt; clause so that we can run this locally.&lt;/p&gt;

&lt;pre&gt;
if(process.env.VCAP_SERVICES){
  var env = JSON.parse(process.env.VCAP_SERVICES);
  var mongo = env['mongodb-1.8'][0]['credentials'];
}
else{
  var mongo = {"hostname":"localhost","port":27017,"username":"",
    "password":"","name":"","db":"db"}
}
&lt;/pre&gt;

&lt;p&gt;The &lt;a href="https://github.com/gatesvp/cloudfoundry_node_mongodb/blob/master/app.js.2"&gt;code&lt;/a&gt; wraps this up in a &lt;code&gt;generate_mongo_url&lt;/code&gt; function that provides a “connection string” of the form &lt;code&gt;mongodb://username:password@host:port/db_name&lt;/code&gt;.&lt;/p&gt; 

&lt;p&gt;Copy in the rest of the code from step 2 on github and test locally.&lt;/p&gt;

&lt;pre&gt;
$ node app.js
$ curl localhost:3000
# connection string for localhost
&lt;/pre&gt;

&lt;p&gt;Once that’s working push the update to the cloud. Notice that we add the name of the project and we don’t get asked any questions:&lt;/p&gt;

&lt;pre&gt;
$ vmc update your_app_name
Uploading Application:
...
Stopping Application: OK
Staging Application: OK                                                         
Starting Application: OK 
# test again
$ curl your_app_name.cloudfoundry.com
# bunch of environment variables
&lt;/pre&gt;
&lt;/div&gt;

&lt;div id="step_3"&gt;
&lt;p&gt;&lt;b&gt; Step 3: now with drivers&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;First we need to install the &lt;code&gt;node-mongodb-native&lt;/code&gt; driver. To do this, we use NPM.&lt;/p&gt;

&lt;pre&gt;
$ npm install mongodb
&lt;/pre&gt;

&lt;p&gt;You should see a new directory at the end of this process: &lt;code&gt;node_modules&lt;/code&gt;. To enable use to include these module on the cloud we add this path to the &lt;code&gt;require&lt;/code&gt; variable at the top of the code.&lt;/p&gt;

&lt;pre&gt;
require.paths.unshift('./node_modules');

if(process.env.VCAP_SERVICES){
...
&lt;/pre&gt;

&lt;p&gt;Our goal here is to build a function for recording a visit. Let’s build that function.&lt;/p&gt;

&lt;pre&gt;
var record_visit = function(req, res){
  /* Connect to the DB and auth */
  require('mongodb').connect(mongourl, function(err, conn){
    conn.collection('ips', function(err, coll){
      /* Simple object to insert: ip address and date */
      object_to_insert = { 'ip': req.connection.remoteAddress, 'ts': new Date() };

      /* Insert the object then print in response */
      /* Note the _id has been created */
      coll.insert( object_to_insert, {safe:true}, function(err){
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.write(JSON.stringify(object_to_insert));
        res.end('\n');
      });
    });
  });
}
&lt;/pre&gt;

&lt;p&gt;Notice the &lt;code&gt;.connect&lt;/code&gt; and &lt;code&gt;.collection('ips'...)&lt;/code&gt;. We’re telling it to store data in the &lt;code&gt;ips&lt;/code&gt; collection.&lt;/p&gt;

&lt;p&gt;Another nice feature is the &lt;code&gt;object_to_insert&lt;/code&gt;. Saving a document with Node+MongoDB is as simple as creating the object and inserting it.&lt;/p&gt;

&lt;p&gt;Let’s fix up the main &lt;code&gt;createServer&lt;/code&gt; function.&lt;/p&gt;

&lt;pre&gt;
http.createServer(function (req, res) {
  record_visit(req, res);
}).listen(port, host);
&lt;/pre&gt;

&lt;p&gt;Then we can test locally and push with &lt;code&gt;vmc&lt;/code&gt;. If this is working locally, you should be able to connect to your local mongod instance and see some data in the &lt;code&gt;ips&lt;/code&gt; collection.&lt;/p&gt;

&lt;pre&gt;
$ mongo localhost:27017/db
&gt; db.ips.find()
...
&lt;/pre&gt;
&lt;/div&gt;

&lt;div id="step_4"&gt;
&lt;p&gt;&lt;b&gt; Step 4&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;At this point, you’ve probably tested a few times and you’ve successfully put data in the database. Now it’s time to get that data out.&lt;/p&gt;

&lt;p&gt;Let’s create a function to print the last 10 visits:&lt;/p&gt;

&lt;pre&gt;
var print_visits = function(req, res){
  /* Connect to the DB and auth */
  require('mongodb').connect(mongourl, function(err, conn){
    conn.collection('ips', function(err, coll){
      /*find with limit:10 &amp; sort */
      coll.find({}, {limit:10, sort:[['_id','desc']]}, function(err, cursor){
        cursor.toArray(function(err, items){
          res.writeHead(200, {'Content-Type': 'text/plain'});
          for(i=0; i &lt; items.length; i++){
            res.write(JSON.stringify(items[i]) + "\n");
          }
          res.end();
        });
      });
    });
  });
}
&lt;/pre&gt;

&lt;p&gt;Let’s update the &lt;code&gt;createServer&lt;/code&gt; method to print when we request &lt;code&gt;/history&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;
http.createServer(function (req, res) {
  params = require('url').parse(req.url);
  if(params.pathname === '/history') {
    print_visits(req, res);
  }
  else{
    record_visit(req, res);
  }
}).listen(port, host);
&lt;/pre&gt;

&lt;p&gt;Again, we test locally and then upload with &lt;code&gt;vmc&lt;/code&gt;. If it all works, you should be able to do this:&lt;/p&gt;

&lt;pre&gt;
$ vmc update your_app_name
...
$ curl your_app_name.cloudfoundry.com
{"ip":"172.30.49.42","ts":"2011-06-15T20:14:18.977Z","_id":"4df9129af354f8682d000001"}
$ curl your_app_name.cloudfoundry.com
{"ip":"172.30.49.43","ts":"2011-06-15T20:14:21.745Z","_id":"4df9129df354f8682d000002"}

# now let's test history
$ curl gvp_node_test.cloudfoundry.com/history
{"ip":"172.30.49.43","ts":"2011-06-15T20:14:21.745Z","_id":"4df9129df354f8682d000002"}
{"ip":"172.30.49.42","ts":"2011-06-15T20:14:18.977Z","_id":"4df9129af354f8682d000001"}
...
&lt;/pre&gt;
&lt;/div&gt;

&lt;div id="going_further"&gt;
&lt;p&gt;&lt;b&gt; Going further&lt;/b&gt;&lt;/p&gt;

&lt;ol&gt;&lt;li&gt; Check out our upcoming &lt;a href="http://www.10gen.com/webinars/nodejs"&gt;Node.js Panel Discussion webinar&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt; For some MongoDB wrappers take a look at 
&lt;ul&gt;&lt;li&gt; &lt;a href="http://mongoosejs.com"&gt;Mongoose&lt;/a&gt;, an ORM / ODM wrapper&lt;/li&gt;
 &lt;li&gt;&lt;a href="http://github.com/craftgear/node-mongoskin"&gt;MongoSkin&lt;/a&gt;, a layer over node-mongodb-native to help reduce callbacks.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt; For building more complex web sites take a look at the &lt;a href="http://expressjs.com"&gt;Express framework&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;

&lt;p&gt;— Gates Voyer-Perrault&lt;br/&gt;
@gatesvp&lt;/p&gt;</description><link>http://blog.mongodb.org/post/6587009156</link><guid>http://blog.mongodb.org/post/6587009156</guid><pubDate>Thu, 16 Jun 2011 10:00:00 -0400</pubDate><category>mongodb</category><category>nosql</category><category>javascript</category><category>nodejs</category><category>node.js</category></item><item><title>A reminder about MongoDB "office hours"</title><description>&lt;p&gt;Very casual whiteboard type chat sessions on a regular basis in SF, NYC, Redwood Shores, Mountain View, and Atlanta.  &lt;a href="http://www.10gen.com/officehours"&gt;Stop by!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also check out the &lt;a href="http://www.meetup.com/find/?keywords=mongoDB&amp;mcId=&amp;mcName=&amp;lat=&amp;lon=&amp;userFreeform=&amp;gcResults=&amp;op=search&amp;resetgeo=true&amp;events=&amp;submitButton=Search"&gt;meetup users groups&lt;/a&gt; in lots of other cities.&lt;/p&gt;</description><link>http://blog.mongodb.org/post/6320979730</link><guid>http://blog.mongodb.org/post/6320979730</guid><pubDate>Wed, 08 Jun 2011 11:21:00 -0400</pubDate></item><item><title>How Journaling and Replication Interact</title><description>&lt;p&gt;Version 1.8 of MongoDB supports &lt;a href="http://www.mongodb.org/display/DOCS/Journaling"&gt;journaling&lt;/a&gt; in the storage engine for crash safety and fast recovery.  An interesting question arises then regarding how journaling interacts with replication.&lt;/p&gt;

&lt;p&gt;A traditional approach might be to wait for the commit (i.e., journal physical write confirmed) before replicating any data.  MongoDB does not do this.  Instead, it allows data to replicate even if the journal write has yet to occur or be confirmed.&lt;/p&gt;

&lt;p&gt;We then must ask “but what happens if we crash before journaling but the data replicated out?”  With &lt;a href="http://www.mongodb.org/display/DOCS/Replica+Sets"&gt;replica sets&lt;/a&gt;, it turns out this is ok.  In a replica set the &lt;a href="http://www.mongodb.org/display/DOCS/Replica+Set+Design+Concepts"&gt;rule&lt;/a&gt; is that the freshest node will be elected primary.  Thus if the crashed node comes back up, but the node which received the unjournaled data is ahead, it will be primary.&lt;/p&gt;

&lt;p&gt;We might then ask about a cascade of failures. This is ok too as replica sets have a notion of rolling back to a consistent point of view.&lt;/p&gt;

&lt;p&gt;How do we know our data won’t be rolled back?  The &lt;a href="http://www.mongodb.org/display/DOCS/Replica+Set+Design+Concepts"&gt;answer&lt;/a&gt; is that a write is truly committed in a replica set when it has been written at a majority of set members.  We can confirm this with the &lt;a href="http://www.mongodb.org/display/DOCS/Verifying+Propagation+of+Writes+with+getLastError"&gt;getLastError&lt;/a&gt; command.  For example, if our write has made it to the journal on two out of three total set members, we know the data is committed even if nodes fail in a cascading sequence, and even if a minority of nodes are permanently lost.&lt;/p&gt;

&lt;p&gt;Why bother replicating so quickly?  It lets us minimize latency between secondaries and primaries.  In addition more writes will be successful than traditionally when a crash occurs.  Yet the latency reduction is the biggest advantage: fsyncing to disks can be slow — replication lag (if on a LAN) can be less than the time to fsync to disk.  Plus both can then be underway concurrently.&lt;/p&gt;</description><link>http://blog.mongodb.org/post/6254464258</link><guid>http://blog.mongodb.org/post/6254464258</guid><pubDate>Mon, 06 Jun 2011 14:15:50 -0400</pubDate></item><item><title>MongoDB live at Craigslist</title><description>&lt;img style="float:right; padding: 10px;" src="http://media.tumblr.com/tumblr_llakepCoMl1qzyevi.png"/&gt;&lt;p&gt;Update: You can view a video of Jeremy Zawodny’s talk at MongoSF on &lt;a href="http://www.10gen.com/video/mongosf2011/craigslist"&gt;10gen.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;MongoDB is now live at Craigslist, where it is being used to archive billions of records.&lt;/p&gt;

&lt;p&gt;Craiglist has kept every post anyone has ever made in a large MySQL cluster.  A few months ago, they began looking for alternatives: schema changes were taking forever (Craigslist’s schema has changed a couple times since 1995) and it wasn’t really relational information. They wanted to be able to add new machines without downtime (which sharding provides) and route around dead machines without clients failing (which replica sets provide), so MongoDB was a very strong candidate.  After looking into a few of the most popular non-relational database systems, they decided to go with MongoDB.&lt;/p&gt;

&lt;p&gt;Jeremy Zawodny is a software engineer at Craigslist and an author of &lt;em&gt;&lt;a href="http://oreilly.com/catalog/9780596101718"&gt;High Performance MySQL&lt;/a&gt;&lt;/em&gt; (O’Reilly).  He kindly agreed to answer some questions about their MongoDB cluster (&lt;em&gt;editor’s comments in italics&lt;/em&gt;).&lt;/p&gt;

&lt;hr&gt;&lt;p&gt;&lt;strong&gt;Any numbers you can give us?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We’re sizing the install for around 5 billion documents.  That’s from the initial 2 billion document import we need to do plus room to grow for a few years to come.  Average document size is right around 2KB.  (&lt;em&gt;Five billion 2KB documents is 10TB of data.&lt;/em&gt;)  We’re getting our feet wet with MongoDB so this particular task isn’t high throughput or growing in unpredictable ways.&lt;/p&gt;

&lt;p&gt;We can put data into MongoDB faster than we can get it out of MySQL during the migration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does your cluster topology look like?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We have several three-machine &lt;a href="http://www.mongodb.org/display/DOCS/Replica+Sets"&gt;replica sets&lt;/a&gt;, each set serving a &lt;a href="http://www.mongodb.org/display/DOCS/Sharding"&gt;shard&lt;/a&gt; of our “archive” database cluster.  The configuration is three replica sets in each &lt;a href="http://en.wikipedia.org/wiki/Colocation_centre"&gt;colo&lt;/a&gt; (two total) to handle our initial build out.  Obviously there will be a set of config servers and routing processes in the mix as well.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Craigslist is using the MongoDB &lt;a href="http://search.cpan.org/dist/MongoDB/"&gt;Perl driver&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Did you find any stumbling blocks relational database developers should watch out for?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Oh, yeah. :-)  I’m planning to write up a &lt;a href="http://blog.zawodny.com"&gt;blog post&lt;/a&gt; on that and I talked about it a bit at &lt;a href="http://www.10gen.com/conferences/mongosv2010"&gt;MongoSV&lt;/a&gt; (&lt;em&gt;watch the &lt;a href="http://www.10gen.com/video/mongosv2010/craigslist"&gt;video&lt;/a&gt;&lt;/em&gt;), too.  The short version is that you have to think differently about indexing and do a bit more bookkeeping of your own.  But on the plus side, you don’t have to pay the join penalty, so you can get your data back a lot faster.&lt;/p&gt;

&lt;p&gt;Character set issues come up as well, since we’re a Latin-1 or Windows-1252 shop currently (but really need to go UTF-8 across the board).  That means some upfront work, but it’s good that MongoDB is UTF-8 end-to-end already.&lt;/p&gt;
 
&lt;p&gt;&lt;strong&gt;Got future plans for your MongoDB cluster?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Too soon to tell!  But I have a few ideas about ways we can use MongoDB to supplement other needs and possibly replace other data stores.  But I really need to think more about them before I go spouting off.&lt;/p&gt;

&lt;hr&gt;&lt;p&gt;Looking into the future, Zawodny hopes for more polish on sharding and replica sets and that some good front-end admin tools will be developed. “But that will come in time, I’m sure.”&lt;/p&gt;

&lt;em&gt;If you’re interested in more details, check out the video’s from Jeremy’s talks at &lt;a href="http://www.10gen.com/video/mongosv2010/craigslist"&gt;MongoSV&lt;/a&gt; or &lt;a href="http://www.10gen.com/video/mongosf2011/craigslist"&gt;MongoSF&lt;/a&gt;.&lt;/em&gt;</description><link>http://blog.mongodb.org/post/5545198613</link><guid>http://blog.mongodb.org/post/5545198613</guid><pubDate>Mon, 16 May 2011 11:00:00 -0400</pubDate></item><item><title>MongoDB Powering MTV's Web Properties</title><description>&lt;p&gt;&lt;i&gt;An interview with Jeff Yemin,  Director of Content Management Systems at MTV Networks and a presenter at the upcoming &lt;a href="http://www.10gen.com/conferences/mongonyc2011"&gt;MongoNYC&lt;/a&gt; conference.&lt;/i&gt;
&lt;br/&gt;&lt;br/&gt;&lt;img style="float:left; padding:10px;" src="http://media.tumblr.com/tumblr_lkzou3lt5j1qzyevi.jpg"/&gt;&lt;b&gt;What do you work on at MTV Networks?&lt;/b&gt;&lt;br/&gt;
I manage the backend development of our next-generation content management system.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Tell us how MTV Networks is using MongoDB. What is the size and scope of the CMS application that you have built?&lt;/b&gt;&lt;br/&gt;
MongoDB is the repository that powers our CMS, which will eventually be used to manage and serve content for all of MTV Networks’ major websites.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Can you tell us why you chose MongoDB?&lt;/b&gt;&lt;br/&gt;
I have to save something for my actual &lt;a href="http://www.10gen.com/conferences/mongonyc2011#agenda"&gt;talk&lt;/a&gt;!  But briefly, MongoDB is a good fit for a lot of reasons.  The schema-less document structure provides a lot of flexibility, while the search capabilities provide a lot more value than you get with key-value stores.  At the same time, from an operational perspective, it feels very much like MySQL, so our systems and DBA groups are quite comfortable managing the deployment.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;What were some of the challenges you faced using MongoDB for a large enterprise application?&lt;/b&gt;&lt;br/&gt;
The biggest was probably convincing people that it was a good idea.  Like most enterprises that have been around for a while, we have a long history of using relational databases, so this is a pretty big change for us.
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;What’s next for MongoDB at MTV?&lt;/b&gt;&lt;br/&gt;
Right now MongoDB is powering the recently re-launched &lt;a href="http://www.spike.com/"&gt;spike.com&lt;/a&gt;, and we are going to be rolling it out on many other major sites within the next year, most likely including &lt;a href="http://www.gametrailers.com/"&gt;gametrailers.com&lt;/a&gt;, &lt;a href="http://www.thedailyshow.com/"&gt;thedailyshow.com&lt;/a&gt;, &lt;a href="http://www.comedycentral.com/"&gt;comedycentral.com&lt;/a&gt;, &lt;a href="http://www.nick.com/"&gt;nick.com&lt;/a&gt;, and numerous international properties. We’ll also be rolling out new MongoDB-based applications for social activity tracking and online polls.
&lt;br/&gt;&lt;br/&gt;
Learn more at Jeff’s talk at &lt;a href="http://10gen.com/conferences/mongonyc2011"&gt;MongoNYC&lt;/a&gt; on June 7. Register before May 17 to take advantage of early bird pricing, which is only $50.&lt;/p&gt;</description><link>http://blog.mongodb.org/post/5360007734</link><guid>http://blog.mongodb.org/post/5360007734</guid><pubDate>Tue, 10 May 2011 09:21:00 -0400</pubDate></item><item><title> Java is on the Rise, Be-aware!</title><description>&lt;div style="font-weight:bold; font-size: 14px; color: #4B3A28;padding-bottom:6px;"&gt;Improving scalable Java application development with MongoDB + Morphia:&lt;/div&gt;

&lt;p&gt;Over the last year I have seen a significant rise in the number of questions and interest from both the greater Java community and enterprise Java shops about MongoDB. Coming from the MongoDB and Java worlds (among others), this is something I have watched with great interest and excitement.

&lt;/p&gt;&lt;p&gt;As one of the authors and project leads for &lt;a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fp%2Fmorphia%2F"&gt;Morphia&lt;/a&gt; (MongoDB Java ORM) I have seen a lot of questions relating to both the core driver and how to build Java applications with MongoDB. A lot of these questions arise from the paradigm shift users experience when moving from the standard SQL/JPA/Hibernate platforms/frameworks to the document oriented world of MongoDB.

&lt;/p&gt;&lt;p&gt;For the last year or so, Morphia has — how long that seems looking back — bridged the gap between the document/map/dictionary world of the core MongodDB Java driver with the cleaner POJO (domain objects) design pattern, which is much friendlier for business logic.

&lt;/p&gt;&lt;p&gt;Over the last few months, the Java MongoDB ecosystem has started to drastically evolve. New features in the core MongoDB server continue to distinguish the product from the crowd and new engineers are joining the MongoDB open source community by contributing Java persistence (mappers) frameworks and libraries.

&lt;/p&gt;&lt;p&gt;As one of the main authors of Morphia, I envision many of the projection/mapping features which we have implemented being included in the core MongoDB Java driver, similar to what other drivers support (.Net/C#, and dynamic languages). 

&lt;/p&gt;&lt;p&gt;Even before I joined 10gen I had been in discussions of how to best integrate the user experience from high-level abstractions such as the JPA EntityManager and DAO pattern into the features supplied with the basic driver. Now that I am a member of the team, and have direct access to the driver (and the great team that has been maintaining it internally, along with the numerous community patches), I am finally in a great position to help make that integration possible. I will in fact be in the best position of all to make this vision come true: I get to do the integration :-)

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Major Version Changes&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;Let’s talk a little about the changes coming in the 3.0* Java driver. First, we have some great ideas of how to improve overall performance for frameworks; these ideas primarily have come from the need to reduce the impedance mismatch of the current driver when being used from frameworks like &lt;a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fp%2Fmorphia%2F"&gt;Morphia&lt;/a&gt;, &lt;a href="http://github.com/mongodb/casbah"&gt;Casbah&lt;/a&gt;, and many others. 

&lt;/p&gt;&lt;p&gt;One of the performance improvements we have in mind will allow us to remove the need to decode binary &lt;a href="http://bsonspec.org"&gt;BSON&lt;/a&gt;, to a temporary java map (DBObject) and then to the final format. In some of the very high volume and real-time analytics deployments, this will be an amazing performance improvement. In addition to reduced latency, the change will also reduce resource allocation as well.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;A little code:&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;With Morphia, and soon the driver, you can do things like this:
&lt;/p&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;@Entity
class Customer {
   @Id ObjectId id;
   String name;
   String[] projects; }
&lt;/code&gt;&lt;/pre&gt;
Save, and find, a single Model/Entity
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;Datastore ds = …;
ds.save(new Customer(“Scott Hernandez”, 
                     new String[]{“java”, “morphia”, “casbah”}));
// QBE(query by example)
Customer scott = ds.find(Customer.class, new Customer(“Scott Hernandez”)).get();
//Iterate over all customers
for(Customer customer : ds.find(Customer.class))
     print(customer);
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;Use the fluent query interface.
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;//Use the fluent query interface
Query&lt;Customer&gt; findMe = ds.find(Customer.class).field(“projects”).equal(“java”);
Customer scott = findMe.get(); //The query is validated by your java class

scott.name = “Scott D. Hernandez”; //change a field 
ds.save(scott); //save the whole object
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;Update just a field or two at a time.
&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;//Update on one field, without needing the full customer object
UpdateOperations&lt;Customer&gt; updates = ds.createUpdateOperations();

updates.add(“projects”, “support”);
UpdateResults&lt;Customer&gt; res = ds.updateFirst(findMe, updates);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Coming very soon we will have better support for mock frameworks and testing isolation by providing interfaces to the major components in the driver. Many (open source) projects built on the driver already have support for mock and isolated testing so having the driver support is a great benefit for all.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Compatibility&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;On the path to these changes we have many other milestones to hit as well. Some of these are internal changes while others will have some outwardly facing impact. The premier goal we have is to make sure that the MongoDB Java driver stays backwards compatible; this will reduce the need for existing applications and deployments to make any changes as we make improvements. There will be some changes that might not fit in this goal but we will keep them as small as possible and highlighted in the release notes.

&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;&lt;h3 style="font-size: 16px;"&gt;Events and More Content&lt;/h3&gt;

&lt;p&gt;&lt;b&gt;Java Web Apps Webinar&lt;/b&gt;, May 12, 1:30p ET/ 10:30a PT

&lt;/p&gt;&lt;p&gt;We will be hosting an online webinar to talk about one way to build webapps using Java and some common open source frameworks (Guice, Stripes and Morphia) in about week.

&lt;/p&gt;&lt;p&gt;You can learn more and register here: &lt;a href="http://www.10gen.com/webinars/javawebapps"&gt;http://www.10gen.com/webinars/javawebapps&lt;/a&gt;

&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;a href="http://www.mongosf.com"&gt;MongoSF&lt;/a&gt; + &lt;a href="http://www.10gen.com/conferences/mongonyc2011"&gt;MongoNYC&lt;/a&gt;&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.mongosf.com"&gt;MongoSF&lt;/a&gt; is a one day conference dedicated to MongoDB on May 24th. There will be loads of talks, including a bunch about MongoDB with Java and Morphia. Find out more about the event and registration at &lt;a href="http://www.mongosf.com"&gt;&lt;a href="http://www.mongosf.com"&gt;www.mongosf.com&lt;/a&gt;&lt;/a&gt;. Register soon, because it’s nearly sold out already.

&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.10gen.com/conferences/mongonyc2011"&gt;MongoNYC&lt;/a&gt; will be held on June 7th and will contain a very similar number of tracks for those on the other coast.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;More Blogs&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;This is just the start of the blogging about the changes coming to the Java driver. There will be many more in-depth posts regarding parts of the driver and interfaces changes.

&lt;/p&gt;&lt;p&gt;&lt;b&gt;Feedback&lt;/b&gt;

&lt;/p&gt;&lt;p&gt;I can be contacted via email as scott -at- 10gen (dotcom).

&lt;/p&gt;&lt;p&gt;Please feel free to submit patches or file issues:
&lt;/p&gt;&lt;p&gt;&lt;a href="http://github.com/mongodb/mongo-java-driver"&gt;&lt;a href="http://github.com/mongodb/mongo-java-driver"&gt;http://github.com/mongodb/mongo-java-driver&lt;/a&gt;&lt;/a&gt;
&lt;br/&gt;&lt;a href="http://jira.mongodb.org/browse/Java%20"&gt;&lt;a href="http://jira.mongodb.org/browse/Java"&gt;http://jira.mongodb.org/browse/Java&lt;/a&gt; &lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
—Scott &lt;/p&gt;</description><link>http://blog.mongodb.org/post/5217011262</link><guid>http://blog.mongodb.org/post/5217011262</guid><pubDate>Thu, 05 May 2011 08:45:00 -0400</pubDate><category>Java</category><category>MongoDB</category><category>Morphia</category><category>mongodb</category><category>nosql</category></item><item><title>MongoDB on EC2 Best Practices</title><description>&lt;p&gt;In light of last week’s EBS issues, we wanted to make sure MongoDB users on EBS are configured to be as robust as possible.  &lt;/p&gt;

&lt;p&gt;A basic setup would consist of a 3 node &lt;a href="http://www.mongodb.org/display/DOCS/Replica+Sets"&gt;replica set&lt;/a&gt;.  The nodes would be roughly laid out like this: &lt;/p&gt;

&lt;p&gt;* A: us-east-1a priority 1&lt;br/&gt;
* B: us-east-1b priority 1&lt;br/&gt;
* C: us-west-1a priority 0&lt;/p&gt;

&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_lkae0aT71y1qzyevi.png"/&gt;&lt;/p&gt;

&lt;p&gt;During steady state, either A or B would be primary.  If the primary went down for any reason (system crash, or loss of one availability zone) the other node in us-east would take over.  This is guaranteed because the west coast node has a priority of 0.  &lt;/p&gt;

&lt;p&gt;If instead the entire east coast region were lost, then you would still have a ful copy of data on C.  If you decided that you were going to make the west coast your primary data center for the duration, you would just bring up a couple more nodes there, and make a new replica set with the data from C.&lt;/p&gt;

&lt;p&gt;More information about running MongoDB on ec2 is available from our &lt;a href="http://www.10gen.com/webinars/ec2"&gt;recent ec2 webinar&lt;/a&gt;.  We are big fans of cloud computing in general and want MongoDB to only get more and more cloud-friendly over time.&lt;/p&gt;

&lt;p&gt;-Eliot&lt;/p&gt;</description><link>http://blog.mongodb.org/post/4982676520</link><guid>http://blog.mongodb.org/post/4982676520</guid><pubDate>Wed, 27 Apr 2011 08:00:00 -0400</pubDate></item><item><title>Getting started with VMware CloudFoundry, MongoDB and Rails</title><description>&lt;i&gt;Listen to Jared Rosoff’s June 2 webinar &lt;a href="http://www.10gen.com/webinars/cloudfoundry"&gt;“VMware Cloud Foundry with MongoDB”&lt;/a&gt;.&lt;/i&gt;&lt;br/&gt;&lt;i&gt;Read about getting started with &lt;a href="http://blog.mongodb.org/post/6587009156/cloudfoundry-mongodb-and-nodejs"&gt;Cloud Foundry, MongoDB, and Node.js&lt;/a&gt;.&lt;/i&gt;

&lt;p&gt;Last week, VMware launched &lt;a href="http://www.cloudfoundry.com"&gt;Cloud Foundry&lt;/a&gt;: an open-source platform as a service. It’s pretty radical in that not only can you run your apps on infrastructure operated by VMware, you can also download Cloud Foundry itself and run it on your own machines!&lt;/p&gt;
&lt;p&gt;But what’s most awesome about Cloud Foundry is that it supports MongoDB right out of the box! In today’s post, we’re going to walk through the creation of a Rails application using MongoDB and Cloud Foundry.&lt;/p&gt; 
&lt;p&gt;Here’s what we’re going to need to do: 
&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="#new_rails_project"&gt;Create a new rails project (skipping Active Record)&lt;/a&gt;&lt;/li&gt; 
&lt;li&gt;&lt;a href="#add_dependencies"&gt;Add the dependencies for MongoMapper&lt;/a&gt;&lt;/li&gt; 
&lt;li&gt;&lt;a href="#code"&gt;Build a simple app that interacts with the database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#credentials"&gt;Set up our credentials so we can talk to Cloud Foundry’s MongoDB&lt;/a&gt;&lt;/li&gt; 
&lt;li&gt;&lt;a href="#push"&gt;Push our application to CloudFoundry&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div id="new_rails_project"&gt;
&lt;b&gt;Create our rails project&lt;/b&gt;&lt;br/&gt;
First we’ll create our new Rails project. My preference is for &lt;a href="http://www.mongomapper.com"&gt;MongoMapper&lt;/a&gt;, so I’m going to skip the ActiveRecord generators when I initialize my project. 
&lt;pre&gt;
$ rails new my_app --skip-active-record
&lt;/pre&gt;
&lt;/div&gt;
&lt;div id="add_dependencies"&gt;
&lt;b&gt;Add the dependencies for MongoMapper&lt;/b&gt;&lt;br/&gt;
Next we need to setup our dependencies. Cloud Foundry will automatically detect that we’re a Rails app, and it will process our Gemfile if we’ve got one. So we’re need to add any dependencies to our Gemfile so they’ll get installed when we deploy. 
This is what our Gemfile looks like: 
&lt;pre&gt;
source "http://rubygems.org"
gem "rails", "3.0.5"
gem "mongo_mapper"
gem "bson_ext"
&lt;/pre&gt;
I’m assuming you’re using Rails 3 here, but you can easily adapt these instructions for other versions. 
&lt;/div&gt;
&lt;div id="code"&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Build a simple app that interacts with the database&lt;/b&gt;&lt;br/&gt;
Now we’ll write a little code to interact with the DB so we can be sure everything’s working. 
&lt;pre&gt;
$ script/rails generate scaffold messages message:string --orm mongo_mapper 
&lt;/pre&gt;
I’m also going to set the root of my rails app to be our new messages controller and remove our &lt;code&gt;public/index.html&lt;/code&gt;. Here’s my routes file: 

&lt;pre&gt;
CloudFoundryRailsTutorial::Application.routes.draw do
  resources :messages
  root :to =&gt; "messages#index"
end
&lt;/pre&gt;

Be sure to delete your &lt;code&gt;public/index.html&lt;/code&gt;!!
&lt;div id="credentials"&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Set up our credentials so we can talk to Cloud Foundry’s MongoDB&lt;/b&gt;&lt;br/&gt;
MongoMapper comes with a generator that will create a basic &lt;code&gt;config/mongo.yml&lt;/code&gt; configuration file for us. 

&lt;pre&gt;
$ script/rails generate mongo_mapper:config
&lt;/pre&gt; 

The file looks like this: 

&lt;pre&gt;
defaults: &amp;defaults
  host: 127.0.0.1
  port: 27017

development:
  &lt;&lt;: *defaults
  database: myapp_development

test:
  &lt;&lt;: *defaults
  database: myapp_test

# set these environment variables on your prod server
production:
  &lt;&lt;: *defaults
  database: myapp
  username: &lt;%= ENV['MONGO_USERNAME'] %&gt;
  password: &lt;%= ENV['MONGO_PASSWORD'] %&gt;
&lt;/pre&gt;

We need to modify this so that it can talk to Cloud Foundry’s infrastructure. When CloudFoundry runs your app, it passes in a bunch of information through an environment variable. We need to pull the host, port, username, and password for MongoDB out of this environment variable.

After some modification, the &lt;code&gt;production&lt;/code&gt; section of your &lt;code&gt;config/mongo.yml&lt;/code&gt; should look something like this: 

&lt;pre&gt;
production:
  host: &lt;%= JSON.parse( ENV['VCAP_SERVICES'] )['mongodb-1.8'].first['credentials']['hostname'] rescue 'localhost' %&gt;
  port: &lt;%= JSON.parse( ENV['VCAP_SERVICES'] )['mongodb-1.8'].first['credentials']['port'] rescue 27017 %&gt;
  database:  &lt;%= JSON.parse( ENV['VCAP_SERVICES'] )['mongodb-1.8'].first['credentials']['db'] rescue 'cloud_foundry_mongodb_tutorial' %&gt;
  username: &lt;%= JSON.parse( ENV['VCAP_SERVICES'] )['mongodb-1.8'].first['credentials']['username'] rescue '' %&gt;
  password: &lt;%= JSON.parse( ENV['VCAP_SERVICES'] )['mongodb-1.8'].first['credentials']['password'] rescue '' %&gt;
&lt;/pre&gt;
Note: The “rescue” clauses are so that you can run this app locally. If you don’t include this and you try to run this app outside of cloud foundry, you’ll get an exception because there’s no VCAP_SERVICES environment variable passed into your app. 
&lt;/div&gt;
&lt;div id="push"&gt;
&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Push our application to CloudFoundry&lt;/b&gt;&lt;br/&gt;
Now we’re ready to test things out. If you haven’t already, you should go ahead and install the &lt;code&gt;vmc&lt;/code&gt; command line tool. There’s a &lt;a href="http://support.cloudfoundry.com/entries/20012337-getting-started-guide-command-line-vmc-users"&gt;getting started with VMC guide here&lt;/a&gt;.
Here’s what it looked like when I deployed my app: 
&lt;pre&gt;
redeye:myapp jsr$ vmc push --runtime ruby19
Would you like to deploy from the current directory? [Yn]: y
Application Name: mongodb-on-cf-demo
Application Deployed URL: 'mongodb-on-cf-demo.cloudfoundry.com'? 
Detected a Rails Application, is this correct? [Yn]: y
Memory Reservation [Default:256M] (64M, 128M, 256M or 512M) 256M
Creating Application: OK
Would you like to bind any services to 'mongodb-on-cf-demo'? [yN]: y
Would you like to use an existing provisioned service [yN]? n
The following system services are available::
1. mysql
2. mongodb
3. redis
Please select one you wish to provision: 2
Specify the name of the service [mongodb-a8a43]: 
Creating Service: OK
Binding Service: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (5K): OK   
Push Status: OK
Starting Application: OK                                                        

redeye:myapp jsr$ 
&lt;/pre&gt;

Now you can point your browser to &lt;a href="http://mongodb-on-cf-demo.cloudfoundry.com/"&gt;&lt;a href="http://mongodb-on-cf-demo.cloudfoundry.com/"&gt;http://mongodb-on-cf-demo.cloudfoundry.com/&lt;/a&gt;&lt;/a&gt; and you should see the list of messages!
&lt;br/&gt;&lt;br/&gt;
Congrats! You’ve got your first Rails app up and running on Cloud Foundry and MongoDB! 
&lt;br/&gt;&lt;br/&gt;
The code for &lt;a href="https://github.com/jsr/cloud-foundry-mongodb-demo"&gt;this mongodb + rails + Cloud Foundry app is up on github&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
Happy coding and be sure to tell us about all the awesome apps you build on Cloud Foundry!
&lt;/div&gt;

&lt;p&gt;
— Jared Rosoff
&lt;/p&gt; &lt;/div&gt;</description><link>http://blog.mongodb.org/post/4719358003</link><guid>http://blog.mongodb.org/post/4719358003</guid><pubDate>Mon, 18 Apr 2011 10:58:00 -0400</pubDate></item><item><title>Introduction to the official C# driver from 10gen</title><description>&lt;p&gt;10gen is happy to announce support for the official C# driver for MongoDB. Several preview releases have already been made available, and the latest, Version 0.11, was released January 25, 2011. Version 1.0 has just been released and includes support for the new features in MongoDB 1.8. 
&lt;br/&gt;&lt;br/&gt;
The official C# driver is designed to be fast and efficient, is fully supported by 10gen, and will have full support for new MongoDB features as new server versions are released. Version 1.0 is compatible with Visual Studio 2008 and 2010 and .NET 3.5. The driver is well suited for use in high load environments as the main classes are all thread safe and connections are efficiently and automatically managed by a connection pool. The driver can connect directly to a particular server, or can connect to a replica set and automatically find the current primary (as well as automatically rollover to a new primary as needed). SafeMode can be enabled to automatically call getLastError after every update operation to check for errors. Full serialization support for C# classes is provided to make integrating your domain model classes with MongoDB easy (including keeping your domain classes persistent ignorant if desired). The serialization support provides several ways for you to customize serialization of particular classes or data types should your classes require special handling. Interoperability with JavaScript and other languages is enhanced by the included JSON reader and writer. GridFS support is provided to deal with large documents (or files) that are too big to store as a single BSON document. 
&lt;br/&gt;&lt;br/&gt;
More information about the official C# driver is available at:
&lt;br/&gt;&lt;br/&gt;
&lt;a href="http://www.mongodb.org/display/DOCS/CSharp+Language+Center"&gt;http://www.mongodb.org/display/DOCS/CSharp+Language+Center&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
A webinar, “Introduction to the New Official C# Driver Developed by 10gen”, is available at:
&lt;br/&gt;&lt;br/&gt;
&lt;a href="http://www.10gen.com/webinars/csharp"&gt;http://www.10gen.com/webinars/csharp&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
We are excited to be officially supporting the .NET community with this new driver.
&lt;br/&gt;&lt;br/&gt;
-Robert Stam&lt;/p&gt;</description><link>http://blog.mongodb.org/post/4052034124</link><guid>http://blog.mongodb.org/post/4052034124</guid><pubDate>Wed, 23 Mar 2011 19:35:48 -0400</pubDate></item></channel></rss>

