0
現在RailsアプリをMongoid 5にアップデートしています。廃止予定のメソッド(find_and_modify)を使用しているコードを更新するのに問題があります。どんな助けもありがとう。 Mongoid 4ではMongoid find_and_modify非推奨
、私はこれを見つけるための方法およびアップサートを持っている:
LineItem.where({
date: Date.today,
location: "Location",
department: "Department"
}).find_and_modify({
"$set" => {
hours: 8,
updated_at: Time.current
},
"$setOnInsert" => {
account_id: ObjectId("5739f4534f4e48b2aa00091c"),
date: Date.today,
location: "Location",
department: "Department",
created_at: Time.current
}
}, upsert: true)
Mongoid 5を使用して同等とは何ですか?
ありがとうございました。 this変更履歴から