Archive | MongoDB RSS feed for this section

[“Thinking”, “About”, “Arrays”, “In”, “MongoDB”]

Greetings adventurers!

The growing popularity of MongoDB means more and more people are thinking about data in ways divergent from traditional relational models. For this reason alone, it’s exciting to experiment with new ways of modelling data. However, with additional flexibility comes the need to properly analyze the performance impact of data model decisions.

Embedding arrays in documents is a great example of this. MongoDB’s versatile array operators ($push/$pull, $addToSet, $elemMatch, etc.) offer the ability to manage data sets within documents. However, one must be careful. Data models that call for very large arrays, or arrays with high rates of modification, can often lead to performance problems.

Continue Reading →

{ "comments": 39 }

How to use MongoDB on RedHat OpenShift with MongoLab

Hey RedHat fans – we’ve got your MongoDB hosting needs covered!

In today’s post we’ll be presenting a quick-start guide on how to connect OpenShift, the free RedHat auto-scaling Platform-as-a-Service (PaaS), with our popular MongoDB Database-as-a-Service (DBaaS), MongoLab.

For demonstration purposes, we’ll be using a Node.js application that we’ve written (available for download here). All it takes to connect your OpenShift application is five easy steps!

Continue Reading →

{ "comments": 7 }

MongoLab at Overdriver.com

Overdriver_Logo

We’re excited to partner with Overdriver, a unique Platform-as-a-Service for gaming that is showcasing their beta service for the first time at this year’s Game Developers Conference (GDC)!

This exciting partnership means that MongoLab will serve as the core data storage provider for Overdriver’s online game developer community. You can find out more right here.

By marrying dynamic cloud scaling with gaming-specific tooling for features like virtual goods and social functionality, Overdriver addresses the biggest demand issue that game studios face: bringing titles to market quickly but with little operational risk.

MongoDB naturally supports the object-oriented information model in games, capturing concepts such as user characters, possessions, game pieces, and state of play. MongoLab’s robust and performant MongoDB-as-a-Service lets Overdriver game developers give their full attention to designing compelling games.

We are fascinated by Overdriver and honored to be an inaugural partner in their ground-breaking specialized PaaS approach.

If you’re in San Francisco this week stop by their booth, #1838, at GDC and meet the Overdriver team. Also, be sure to sign up for an account at Overdriver.com. FYI, creating a new environment at Overdriver automatically creates a new MongoLab account and database.

We can’t wait to play with what you build!

Replication Lag & The Facts of Life

So you’re checking in on your latest awesome application one day — it’s really getting traction! You’re proud of its uptime record, thanks in part to the MongoDB replica set underneath it. But now … something’s wrong. Users are complaining that some of their data has gone missing. Others are noticing stuff they deleted has suddenly reappeared. What’s going on?!?

Don’t worry… we’ll get to the bottom of this! In doing so, we’ll examine a source of risk that’s easy to overlook in a MongoDB application: replication lag — what it means, why it happens, and what you can do about it.

Continue Reading →

{ "comments": 7 }

Object Modeling in Node.js with Mongoose

Check it out! We’ve just updated our Heroku Dev Center tutorial on object modeling in Node.js using Mongoose, a MongoDB ODM library. Mongoose gives your collections structure and simplifies Node’s callback patterns to make using MongoDB with Node.js even easier.

Learn more and download the sample Node.js app right here at the Heroku Dev Center.

Node.js and MongoLab on Windows Azure

(This tutorial was originally published on the Windows Azure documentation portal in January 2013)

Greetings, adventurers! Welcome to MongoDB-as-a-Service. Are you looking to create a Node.js Application on Windows Azure with MongoDB using the MongoLab Azure Store add-on?

In this tutorial you will:

  1. Provision the database – The Windows Azure Store MongoLab add-on will provide you with a MongoDB database hosted in the Windows Azure cloud and managed by MongoLab‘s cloud database platform.
  2. Create the app – It’ll be a simple Node.js app for maintaining a list of tasks.
  3. Deploy the app – By tying a few configuration hooks together, we’ll make pushing our code a breeze.
  4. Manage the database – Finally, we’ll show you MongoLab’s web-based database management portal where you can search, visualize, and modify data with ease.

At any time throughout this tutorial, feel free to kick off an email to support@mongolab.com if you have any questions. To complete this tutorial, you need a Windows Azure account that has the Windows Azure Web Sites feature enabled. You can create a free trial account and enable preview features in just a couple of minutes. For details, see the Create a Windows Azure account and enable preview features tutorial.

In addition, ensure that you have the following installed:
Continue Reading →

{ "comments": 3 }

Experiment with MongoDB 2.4 on MongoLab!

Hello to all our friends and users!

We’re happy to announce that free, experimental databases running MongoDB 2.4 are now available at MongoLab! To get started quickly, follow our step-by-step guide.

Please note: This release is not ready for production yet and should not be used for any production applications.

Release Highlights

Here are the exciting new features and improvements in MongoDB 2.4 that we’d like to highlight:

Full-text search

For your exploration, we are boldly ignoring the warning label on this feature, which is described as an “experimental feature” in 2.4, and are running these servers with textSearchEnabled=true.

You get one text index per collection and create it, similarly to spatial indexes, by providing a special value in your index creation call.

The following simple example text-indexes the “skills” field of the “players” collection.

> db.players.ensureIndex({"skills": "text"})

You can include more than one text-indexed field in a single text index as well as other fields, such as:

> db.players.ensureIndex({"skills": "text", "interests": "text", "age": 1})

To run a query that returns documents that contain the word “telepathy” (case-insensitive) in either the skills or interests fields:

> db.players.runCommand("text", {"search": "telepathy"})

There are several considerations when making a text index and even useful options such as weighting of fields. So… before you make use of this feature, be sure to read the text indexes documentation.

The above example uses the mongo shell. If you want to run through this example in MongoLab’s admin UI, scroll on down…

JavaScript engine now uses v8 as the default

The default JavaScript interpreter used throughout MongoDB, for the mongo shell, mapreduce, $where and eval is now v8 instead of SpiderMonkey. For all users making use of the JavaScript engine, we encourage you to run the same code against this new engine and see how it performs!

Better GeoSpatial indexing

Spherical Geospatial queries are now supported by their own index type. You can create this new type of index just like you currently create a geospatial index, except that you need to specify “2dsphere” in the index definition instead of “2d”. Much like the 2d index requirement of storing [long, lat] data in a certain format, 2dsphere indexes have specific data considerations; for example, you must store a point, line, or polygon in GeoJSON format.

This new index type becomes even more useful with the $geoIntersects operator. Now, MongoDB can tell you if two of your shapes overlap. This is a powerful but specialized tool, so familiarize yourself with the details by reading the release notes and make sure it’s right for you.

An interrupted index build can now be resumed

Ah – this feature improvement is music to our ops-centric ears!  Previously if your mongod process died (either through intentional shutdown or unexpected termination) while you were building an index, you had to start the index build from scratch again.  As of this release, mongod will continue where it left off on an index build after the process starts again.

Example: A simple full-text search using MongoLab

Below is a step-by-step guide to creating a free database running MongoDB 2.4 and running your first full-text search.

[1] Sign up for a MongoLab account if you don’t already have one

[2] Click the “Create new” button after you are logged in to create the database, checking the highlighted checkbox below.  Note that database names need to be unique within an account and mongod process.
Screen Shot 2013-02-07 at 12.44.48 PM

[3] On the “Collections” tab click “Add” and create a collection called “players”

[4] We need some data to run a search against, so click into the row representing this collection so that we can add some.

[5] Click “Add” and copy the following document into the JSON editor:

     { "skills": "telepathy archery",
       "interests": "eating drinking",
       "age": 34 }

[6] On the “Indexes” tab click “Add” to text-index the “skills” and “interests” fields

Screen Shot 2013-02-08 at 12.42.25 PM

[7] Let’s run our first full-text search! On the “Tools” tab and the “commands” sub-tab, select the “text” command:

Screen Shot 2013-02-08 at 12.37.08 PM

Questions or Thoughts?

As you play around with our experimental databases running this new release, please email us anytime! We are eager to help you as you explore this exciting release or if you have any other questions or thoughts about MongoDB.

{ "comments": 3 }

DZone MongoDB Reference Card

As developers we’re always appreciative of documentation that lets us absorb a lot of detailed information as quickly as possible. While nothing can replace a detailed reading of the core MongoDB documentation from 10gen, a few pages of pithy reminders can make operational life a lot easier.

MongoLab sponsored the recent DZone reference card for MongoDB. Here’s a little snippet below. Download the rest of it here http://refcardz.dzone.com/refcardz/mongodb(registration with DZone required)

Dzone Refcard screenshot-02

Thanks to Kristina Chodorow and the 10gen crew for a nice reference card and to the folks at DZone for producing it!

UPDATE 2013-02-06: added note saying that DZone requires registration