Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Created December 25, 2012 21:28
Show Gist options
  • Save arthurnn/4375544 to your computer and use it in GitHub Desktop.
Save arthurnn/4375544 to your computer and use it in GitHub Desktop.
1.9.3p194 :008 > Atm.create! :name => 'td'
=> #<Atm _id: 50da19f3803a9372a4000001, name: "td", _type: "Atm">
1.9.3p194 :009 > Item.create! :name => 'item'
=> #<Item _id: 50da19fb803a9372a4000002, name: "item", _type: "Item">
1.9.3p194 :010 > Item.all.map &:_type
=> ["Atm", "Item"]
1.9.3p194 :011 > Item.all
=> #<Mongoid::Criteria
selector: {}
options: {}
class: Item
embedded: false>
1.9.3p194 :012 > Item.all.map &:_type
=> ["Atm", "Item"]
1.9.3p194 :013 > Atm.all.map &:_type
=> ["Atm"]
1.9.3p194 :014 > Item.all.map &:_type
=> ["Atm", "Item"]
1.9.3p194 :015 > Item.ne(_type: 'Atm').map &:_type
=> ["Item"]
1.9.3p194 :016 >
1.9.3p194 :017 > Item.where(_type: 'Item').map &:_type
=> ["Item"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment