常见错误
Mongoid/Moped 身份验证错误:失败,错误为13
如果遇到以下错误:
Moped::Errors::OperationFailure: The operation: #<Moped::Protocol::Command @length=83 @request_id=5 @response_to=0 @op_code=2004 @flags=[] @full_collection_name="mongose_development.$cmd" @skip=0 @limit=-1 @selector={:getlasterror=>1, :w=>1} @fields=nil> failed with error 13: "not authorized for insert on mongose_development.people" See https://github.com/mongodb/mongo/blob/master/docs/errors.md for details about this error. from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/operation/read.rb:50:in `block in execute' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/node.rb:594:in `[]' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/node.rb:594:in `block (2 levels) in flush' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/node.rb:593:in `map' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/node.rb:593:in `block in flush' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/bundler/gems/moped-10abbf3eac37/lib/moped/node.rb:617:in `block in logging' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:164:in `block in instrument' from /.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrumen
该错误是由 Moped 引起的,Moped 是一种 Ruby 驱动程序,但 Mongoid 已不再使用该驱动程序。 升级到 Mongoid 5 + 应可解决此问题。
您可以在此处找到有关此问题的更多信息: MONGOID-4067 。