This bug exists only in Mongoid 3 (testing on 3.0.17). Mongoid 2 doesn't have the bug.
Route belongs_to AirportRoute
AirportRoute has_one Route
>> foo = Route.first
MOPED: 127.0.0.1:27017 QUERY database=gocheap_development collection=routes selector={"$query"=>{}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.6602ms)
#<Route _id: 50190e164c4c6c958866b1f7 ... >
>> foo.airport_route
MOPED: 127.0.0.1:27017 QUERY database=gocheap_development collection=airport_routes selector={"$query"=>
, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.7024ms)
MOPED: 127.0.0.1:27017 QUERY database=gocheap_development collection=routes selector={"$query"=>
, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 batch_size=nil fields=nil (0.7691ms)
#<AirportRoute _id: 50d85fcabdaa57462e000001 ... >
The last query to the routes collection is unnecessary, as we already have the route.