簡體   English   中英

Rails:參數數量錯誤(給定 2,預期為 1)MongoID

[英]Rails: Wrong number of arguments (given 2, expected 1) MongoID

我正在嘗試打開我的 MongoDB 模型,但是,我收到以下錯誤:

MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s

我的 Mongo 憑據是正確的,我可以連接到 Rails 之外的數據庫集合。

錯誤的前幾行是:

Started GET "/admin/xsl_sheet" for xxx.xxx.xxx.xxx at 2020-03-03 13:49:54 UTC
Processing by RailsAdmin::MainController#index as HTML
Parameters: {"model_name"=>"xsl_sheet"}
(5.0ms)  SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4
CACHE (0.1ms)  SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4  [["id", "4"]]
CACHE (0.2ms)  SELECT `companies`.`name` FROM `companies` WHERE `companies`.`id` = 4  [["id", "4"]]

MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslStart | SUCCEEDED | 0.007s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | STARTED | {}
MONGODB | xxx.xx.x.xxx:27017 | db.saslContinue | SUCCEEDED | 0.006s
MONGODB | xxx.xx.x.xxx:27017 | db.find | STARTED | {"find"=>"TestCompanyNumber2_xsl_sheets", "filter"=>{"assetable_id"=>4}, "limit"=>1, "skip"=>0, "sort"=>{"_id"=>-1}, "projection"=>{"_id"=>1}}
MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s
Rendered /Project/app/views/rails_admin/main/index.html.haml within 
    layouts/rails_admin/application (349.7ms)
    Rendered public/500.html (64.4ms)
    wrong number of arguments (given 2, expected 1)
    /GEMS/gems/bson-4.8.0-java/lib/bson/hash.rb:115:in `from_bson'

編輯:

這是 rails_admin.rb 中的代碼(我相信)它負責從 MongoDB 中提取對象:

c.model XslSheet do
  label Proc.new {"Xsl Sheet"}
  navigation_label Proc.new {I18n.t('navigation.actions')}
  weight 303
  navigation_icon 'fa fa-file-excel-o'
  list do
    scopes [:applicationId]
    field :data_file_name
    field :updated_at
  end
end

這是https://jira.mongodb.org/browse/RUBY-2146 降級到 bson 4.7.0,直到 4.8.2 發布。

為了幫助人們回答您的問題,請包括您使用的軟件版本(在這種情況下, mongoidmongobson版本是相關的),以及您使用 JRuby 的事實。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM