MongoDB Schema Design: Insights and Tradeoffs from Jetlore
MongoDB’s flexible schema is a powerful feature, and to build a successful first application you need to know how to leverage this feature to its full extent. In this presentation, Montse Medina outlines lessons learned from building Jetlore, a social content marketing platform. Some performance tips from this video:
- Sometimes it’s ok to randomize your sharding key. When you have lots of users that want to read from other users, you’ll need to randomize it in order to have fewer disk seeks per shard.
- Reduce collection size by always using short field names as a convention. This will help you save memory over time.
- Always test your queries with .explain() to check that you’re hitting the right index.
December 21, 2012