0
我有用戶和帖子之間的關聯,因爲用戶有很多帖子。 我的查詢如User.includes(:posts).all
。我想寫到哪條件的職位,但我得到了錯誤無效包括如何在mongoid中包含條件?
User.includes(:posts,with: -> (posts) {where(post.likes > 100)}
include Mongoid::Document
我有用戶和帖子之間的關聯,因爲用戶有很多帖子。 我的查詢如User.includes(:posts).all
。我想寫到哪條件的職位,但我得到了錯誤無效包括如何在mongoid中包含條件?
User.includes(:posts,with: -> (posts) {where(post.likes > 100)}
include Mongoid::Document
試試這個,
User.includes(:posts).where("posts.likes", > 100)
我做MongoDB中 –
告訴我,這不是在MongoDB中 – Navin
是工作, iam使用mongoDb作爲數據庫。 Mongoid是ODM。 –