grouping documents into smaller query sets (speed) • Each top level entity in your app would have its own collection (users, articles, etc.) • Indexable by one or more key
nds all Johns • db.collection. fi nd({‘ fi rst_name’: /^J/}) # regex • db.collection. fi nd_ fi rst({‘_id’:1}) # fi nds fi rst with _id of 1 • db.collection. fi nd({‘age’: {‘$gt’: 21}}) # fi nds possible drinkers • db.collection. fi nd({‘author. fi rst_name’:‘John’}) # subdocument • db.collection. fi nd({$where:‘this.age >= 6 && this.age <= 18’})
$lte, $size, $where • : fi elds (like :select in active record) • :limit, :offset for pagination • :sort ascending or descending [[‘foo’, 1], [‘bar’, -1]] • count and group (uses map/reduce)
my fork of validatable) • Connection and database can differ per document • Create and Update with single or multiple • Delete and Destroy and _all counterparts • Find: id, ids, :all, : fi rst, :last • Associations
replication) • Upserts db.collection.update({‘_id’:1}, {‘$inc’:{‘views’:1}}) • Multikeys (think tagging and full text search) • GridFS and auto-sharding