10 common tasks for MongoDB

MongoDB is a $1.2 billion company and one of the hottest tech ventures around. But what's its flagship product good for?

My company has been big into MongoDB over the past year. We've seen all kinds of MongoDB projects that we or our partners have worked on, so I figured it was worth stuffing them into a top 10 list, with the intent to enlighten those who still want to know which tasks might be best handled by the document flavor of NoSQL databases. The jobs we've encountered break down along these lines:

1. Profiles of people

Yes, LDAP is fine for identity when you're authenticating or authorizing, but what about profiling things or people that aren't strongly associated with the system? What about criminal records or child support suspects or customer rewards? What about users of promotions and what they clicked on? There's always new data to add to the user's profile, from the usual top-level stuff (phone, address, email, and so on) to information a layer below (such as phone type). Other database types haven't evolved fast enough to capture the hundred ways we contact each other or the dozens of ways we pay for things.

[ Work smarter, not harder with InfoWorld's roundup of tips and trends programmers need to know in the Developers' Survival Guide. Download the PDF today! | Keep up with the latest developer news with InfoWorld's Developer World newsletter. ]

2. Product/catalog data

Way back when, I worked for a cellphone manufacturer (or two) and later a chemical company. Each had a weird version of the same problem: Products were composed of other products, and which products those were composed of changed over time and tended to have more than one brand or identifier. Capturing the thing that contains the thing that contains the thing is much simpler in a document database than in some other database types.

3. Geospatial data

This isn't necessarily because MongoDB is a great document database, but because it has specific geospatial features. Either way, MongoDB is your friend, whether you're calculating your bike ride distance or figuring out geospecific information about your customers.

4. Funds, mutual funds, and so on

The finance industry is complicated, so don't make it more complex than it needs to be. Investment vehicles often are composed of other investment vehicles, which are then composed of other investment vehicles. Whether this is a "bandwidth" fund or a mutual fund or a fund of funds, if you're trying to perform while flattening the data out, you may suffer. Heck, the industry is full of documents that contain documents that contain documents, so why not use a document database?

5. Metadata

As Forrest Gump said, "it happens," and you have lots of it. You need to categorize and say what "it" is like. MongoDB does this well. There are other database types that will also work (graph databases), but MongoDB is a fine choice.

6. Talk

People are social creatures, and over the last decade or so we've generated exabytes of social data. Mongo is a fine choice to handle the load. Often, people talk topically, with a lot of associated metadata. MongoDB is good for storing that too.

7. Content

They don't call MongoDB a "document" database for nothing. It's great for serving up text and HTML, as well as for storing and indexing content and controlling its structure.

8. Games

You have to water those flowers or serve those restaurant patrons or grow your vegetables or kill zombies or whatever. Games have goals, which consist of multiple objectives obtained through achievement or paying your way out. Whether it's a titanium rake or a BFG 9000, MongoDB can handle the concurrency and save the (often multilevel) data.

9. Events

MongoDB may not be the only game in town with regards to event logging, but it's a perfectly good choice that won't slow you down.

10. Bills/invoices

Orders have line items containing product data. The order is also sent to a location and billed to another location. This is how it is and always has been. Orders also progress through many states. You might freak over the idea of a NoSQL database doing "transactions," but Mongo can perform these as discrete operations if you've properly designed your document. MongoDB can handle the concurrency, can efficiently "add one more," and can track the changes as the bill of sale moves through the system.

What kinds of projects are you doing with MongoDB? Where have you found it to be perfectly suitable, and where have you decided something else was better? Let me know in the comments.

This article, "10 common tasks for MongoDB," was originally published at InfoWorld.com. Keep up on the latest developments in application development, and read more of Andrew Oliver's Strategic Developer blog at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.

Mobile Security Insider: iOS vs. Android vs. BlackBerry vs. Windows Phone
Join the discussion
Be the first to comment on this article. Our Commenting Policies