-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Hi,
I don't know it is my problem or possible bug of mongoid.
Thanks.
[28] pry(main)> tracking.checkpoints.where(:processing_port => 'origin', :tag.ne => nil).desc(:checkpoint_time) => #<Mongoid::Criteria selector: {"processing_port"=>"origin", "tag"=>{"$ne"=>nil}}, options: {:sort=>{"checkpoint_time"=>-1}}, class: Checkpoint, embedded: true> [29] pry(main)> tracking.checkpoints.where(:processing_port => 'origin', :tag.ne => nil).desc(:checkpoint_time).first => #<Checkpoint _id: 4fe301072cfb39b016000056, _type: nil, created_at: 2012-06-21 19:09:59 +0800, updated_at: 2012-06-21 19:09:59 +0800, tag: "Delivered", checkpoint_time: 2012-06-16 00:00:01 +0800, processing_port: "origin", coordinate: nil>
[30] pry(main)> tracking.checkpoints.where(:processing_port => 'origin', :tag.ne => nil).asc(:checkpoint_time) => #<Mongoid::Criteria selector: {"processing_port"=>"origin", "tag"=>{"$ne"=>nil}}, options: {:sort=>{"checkpoint_time"=>1}}, class: Checkpoint, embedded: true> [31] pry(main)> tracking.checkpoints.where(:processing_port => 'origin', :tag.ne => nil).asc(:checkpoint_time).last ArgumentError: comparison of Checkpoint with Checkpoint failed from /Users/Dante/.rvm/gems/ruby-1.9.3-p194@global/gems/mongoid-3.0.0.rc/lib/mongoid/contextual/memory.rb:358:in `sort!'