26
Mongoid Ate My Homework 10 quick gotchas from using mongoid in production. - Jude

Mongoid ate my homework

  • Upload
    slowjud

  • View
    214

  • Download
    4

Embed Size (px)

DESCRIPTION

My talk about Mongoid for RORO Syd.

Citation preview

Page 1: Mongoid ate my homework

Mongoid Ate My Homework

10 quick gotchas from using mongoid in production.- Jude

Page 2: Mongoid ate my homework

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

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

Page 3: Mongoid ate my homework

Gratuitous bike porn

Page 4: Mongoid ate my homework

Now for my talk

Page 5: Mongoid ate my homework
Page 6: Mongoid ate my homework

MongoDB is not relational

Page 7: Mongoid ate my homework

MongoDB only uses one index per query

Page 8: Mongoid ate my homework
Page 9: Mongoid ate my homework

Nil does not unset a field

Page 10: Mongoid ate my homework
Page 11: Mongoid ate my homework

Nil is not the opposite of exist

Page 12: Mongoid ate my homework
Page 13: Mongoid ate my homework

BigDecimal type sorts alphabetically

Page 14: Mongoid ate my homework
Page 15: Mongoid ate my homework

Embedded objects must have an

embedded_in declared

Page 16: Mongoid ate my homework
Page 17: Mongoid ate my homework

Indexes don’t get created on embedded

objects

Page 18: Mongoid ate my homework
Page 19: Mongoid ate my homework

Scopes should go on the parent object

Page 20: Mongoid ate my homework

Callbacks on embedded objects are

not run by default

Page 21: Mongoid ate my homework
Page 22: Mongoid ate my homework

Don’t try and perform two atomic operations

on the same field in the same call

Page 23: Mongoid ate my homework
Page 24: Mongoid ate my homework

Questions?

Page 25: Mongoid ate my homework

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

Page 26: Mongoid ate my homework

Thank You