每個用戶都有一個地址。 class User
include Mongoid::Document
has_one :address
end
class Address
include Mongoid::Document
belongs_to :user
field :street_name, type:String
end
u =
我正在使用ruby on rails作爲我的API與mongoid。假設我有兩個模型: class Human
field: salary, type: Integer
has_many: dogs
end
class Dog
field: name, type: String
belongs_to: human
end
我想要獲取人類在查詢所有
問題:在使用MongoDB中查詢排序,並告訴我使用allowDiskUse:true選項查詢 我的記憶是越來越超出。但在mongoid軌道中,聚合函數沒有傳遞任何選項。 我得到的錯誤: Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation.