Mongoid ate my homework

Preview:

DESCRIPTION

My talk about Mongoid for RORO Syd.

Citation preview

Mongoid Ate My Homework

10 quick gotchas from using mongoid in production.- Jude

I’m @slowjud on everything (twitter/github)

I work at SplitIt.We run www.betterbills.com

Gratuitous bike porn

Now for my talk

MongoDB is not relational

MongoDB only uses one index per query

Nil does not unset a field

Nil is not the opposite of exist

BigDecimal type sorts alphabetically

Embedded objects must have an

embedded_in declared

Indexes don’t get created on embedded

objects

Scopes should go on the parent object

Callbacks on embedded objects are

not run by default

Don’t try and perform two atomic operations

on the same field in the same call

Questions?

Gists

Slides: http://www.slideshare.net/slowjud/mongoid-ate-my-homework

The good models: https://gist.github.com/slowjud/9476959The bad models: https://gist.github.com/slowjud/9476981All of the queries: https://gist.github.com/slowjud/9477341

Thank You

Recommended