This particular application has been collecting data for months now, but hasn’t really had any users by design. At 33GB of data, pulling up a list of messages received was taking f-o-r-e-v-e-r! So I decided to document how to go about and fix a running production system… Hope it helps. Log into mongo console and …
Category Archive: MongoDB
Feb 07
Exporting MongoMapper Objects to JSON
I wanted to export a MongoMapper document and it’s related documents as JSON — with embedded arrays for the collections. Invoking to_json did not seem to work perfectly, so I set about to discover what was going on. Conclusion If you use Embedded Documents for every associated document, the to_json method will work perfectly. If …
Dec 28
MongoDB Group Map-Reduce Performance
I wanted to get some aggregated count data by message type for a collection with over 1,000,000 documents. The model is more or less this (a lot removed for simplicity): class MessageLog include MongoMapper::Document # Attributes :::::::::::::::::::::::::::::::::::::::::::::::::::::: # Message’s internal timestamp / when it was sent key :time, Time # Message type key :event_type, String, …
Dec 01
MongoDB Index Performance
As part of this (unintended) mini-series on MongoDB and indexing, I had written a little test to see if I could document performance gains through indexing. I used realworld data, albeit only 50,000 records, to query out a handful or documents (24 being the most). Related posts: Indexing Discussed Configuring MongoDB Indexes Here is the …
Nov 26
A Walk Through the Valley of Indexing in MongoDB
As you walk through the valley of MongoDB performance, you will undoubtedly find yourself wanting to optimize your indexes at some point or other. How to Watch Your Queries Run your database with profiling on. I have an alias for starting up mongo in profile mode (‘p’ stands for profile): alias mongop=”<mongodb-install>/bin/mongod –smallfiles –noprealloc –profile=1 …
May 18
Mongo Remembers All Keys
On the MongoMapper group list, Nick was wondering about getting key names from the model. But he noticed it remembered keys that had once been used… He wanted to only be able to see the current state of his MongoMapper class, I suppose… No dice, Nick! Remember, MongoMapper Don’t Care! MongoMapper also does not forget! …
Apr 30
MongoDB Honey Badger
In case you don’t know about the Honey Badger—you have to watch this video. Then you will see why MongoDB is a close cousin to this feared and fearless animal! Developing a new project where your domain classes/tables are changing rapidly? MongoDB don’t care! Tired of running rake db:migrate? MongoDB don’t care! Need to add …
