PacktLib: Learning Mongoid

Learning Mongoid

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

What's so Awesome about Mongoid?

A practical approach using the Sodibee library system

Notice about Mongoid 2.x

Mongoid and MongoMapper

Summary

Mongoid Document Model

The Mongoid document

Embedded documents

Localization

Mass assignment and security

Summary

Persisting Documents

MongoDB persistence strategy

Validations

Callbacks

Summary

Mongoid Relations

Configuring relationships

has_one – the one-to-one relation

has_many – the many-to-one relation

The belongs_to relation

has_and_belongs_to_many – the many-to-many relation

Polymorphic relations

embeds_many – embedding many documents

embeds_one – embed one document

embedded_in – resolving children

Embedded polymorphic relations

Summary

Mongoid Queries

Origins of Origin

Query selectors

Mongoid criteria

Queries on arrays and hashes

Atomic modifiers

Querying with indexed fields

The aggregation framework

Geolocation queries

Summary

Performance Tuning

MongoDB environment

Indexes

IdentityMap

MapReduce and the aggregation framework

Monitoring query performance

Good practices and recommendations

Summary

Mongoid Modules

Timestamping

Versioning

Paranoia

Acts as state machine (aasm)

Summary

Index