Saturday, September 6, 2014

MongoDB Links

Recently, I've been doing a lot of research into MongoDB in preparation for a talk at Sitecore Symposium.  Here are some useful resources I've come across:

First Steps

  • try.mongodb.org is an online tutorial that teaches basic syntax in about 15 minutes.   
  • The MongoDB  download page.  MongoDB is open source, and straightforward to install.  
  • A walkthrough of getting MongoDB installed with Sitecore 7.5.

MongoDB Syntax

  • The bios collection, is a useful data set for exploring querying syntax.  I will use this to show querying in my talk.
  • The official MongoDB querying tutorial
  • An SQL to MongoDB conversion chart.
  • And a few noteworthy features:
    • $elemMatch to specify array elements that meet multiple conditions.
    • $ and $slice projection operators.  Both help filter returned array elements.
    • Regex support, which leverages indexes, and is especially efficient for "prefix" queries that specify the start of a string value.
    • Simulating multi-document transactions.  A good read, gets you thinking in advanced MongoDB terms.

Aggregation

MongoDB offers two approaches to aggregation, a JavaScript based Map/Reduce API, and an aggregation pipeline, introduced with version 2.2. From my own experience, the pipeline is a lot more powerful and easy to work with.
  • There's a lot of material on the aggregation pipeline. For my money, the best place to get started is the zipcode tutorial.  
  • Map Reduce examples.
  • Aggregation feature comparison chart.

Indexing

Like QueryAnalyzer's "Display Execution Plan", MongoDB has functionality to explore whether a query is being executed efficiently, or whether indexes need to be added.  This is done through the ".explain()" method.

  • Evaluating query performance with .explain().
  • An overview of the different types of indexes MongoDB supports.  A few worth noting: TimeToLive (autodeletes records), geospatial.

Server Configuration

  • MongoDB has a range of security features, including authentication, role-based security, and SSL support. A good overview can be found in the security checklist
  • Any production implementation should use replication. This is discussed here, and there is a tutorial here.
  • Sharding of course is the big deal about MongoDB.  I discussed why this is a driver for Sitecore's move to MongoDB in a recent post on the Velir blog. Here is MongoDB's introduction, and a tutorial to get your feet wet.

Courses

There are some excellent courses on Pluralsight.

  • Introduction to MongoDB focuses on MongoDB from the server side, with a focus on topics like replication and architecture.
  • Using MongoDB with ASP.NET MVC shows how to build an application in C# using MongoDB, and is an excellent source for understanding how to code with the C# driver. 

Okay, that should get you started. Happy coding!




No comments:

Post a Comment