我發現Eloquent的加入邏輯比典型的準備語句複雜得多(閱讀我討厭它)。 有人可以幫我把下面的查詢翻譯成一個明智的雄辯的查詢,這是整個急切加載? SELECT C.id,
C.seo_alias
FROM store_variants AS A
LEFT JOIN variants AS B ON B.id = A.id_variant
LEFT JOIN products A
我有三個相關的模型。 1.用戶模型 public function users_wishlst(){
return $this->hasMany('App\Users_wishlst');
}
2.產品型號 public function users_wishlst(){
return $this->belongsTo('App\Users_wishlst')
我目前有一個需要11秒才能加載的頁面。我使用Bullet Gem來幫助我找到N + 1查詢發生的位置。它給我一些輸出,但我真的不知道該怎麼辦。下面是子彈輸出: GET /events/1679/dashboard
USE eager loading detected
RSVP => [:tickets]
Add to your finder: :includes => [:t
假設我有3種型號,A,B和C: class A
include Mongoid::Document
has_many :bs
...
class B
include Mongoid::Document
belongs_to :a
has_many :cs
...
class C
include Mongoid:
我想手動建立一系列的查詢來解決mongo缺乏連接和mongoids缺乏熱切的加載。假設我有2類: class A
include Mongoid::Document
has_many :bs
...
class B
include Mongoid::Document
belongs_to :a
...
如果我運行BS查詢: bs = B.where(...)
結果是Mong