ruby-on-rails – Moped :: Errors :: OperationFailure失败,错误“没有这样的cmd

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Moped :: Errors :: OperationFailure失败,错误“没有这样的cmd前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我最近使用rails 3.2.12和 ruby 1.9.3从mongoid 2.0.2升级到mongoid 3.
Following issue comes when save command excutes => @new_node.save


  Moped::Errors::OperationFailure (The operation: #<Moped::Protocol::Command
      @length=366
      @request_id=30
      @response_to=0
      @op_code=2004
      @flags=[:slave_ok]
      @full_collection_name="campus_dev.$cmd"
      @skip=0
      @limit=-1
      @selector={:aggregate=>"nodes",:pipeline=>[{"$match"=>{"parent_id"=>"51382df8851d1912b7000009","_id"=>{"$ne"=>"513f24952f1feda4bc000002"},"position"=>{"$nin"=>[nil]}}},{"$group"=>{"_id"=>"position","count"=>{"$sum"=>1},"max"=>{"$max"=>"$position"},"min"=>{"$min"=>"$position"},"sum"=>{"$sum"=>"$position"},"avg"=>{"$avg"=>"$position"}}}]}
      @fields=nil>
    Failed with error "no such cmd"):
      app/controllers/nodes_controller.rb:37:in `create'

解决方法

您没有提到将MongoDB版本升级到最新版本(当时).

如果您指向一个不能识别“聚合”命令的旧MongoDB服务器,那么您将收到此错误.

类似错误的所有实例似乎都指向较旧的mongod进程.

原文链接:https://www.f2er.com/ruby/269789.html

猜你在找的Ruby相关文章