mongoid3

    7熱度

    1回答

    正如標題所示。我找不到任何與Mongoid 3相關的東西。我發現的東西只適用於mongoid的舊版本,沒有使用Moped。 我發現這一點,這是行不通的: def self.install_javascript getWeekJs = Rails.root.join("lib/javascript/getWeek.js") if collection.master['system

    1熱度

    1回答

    我在觸發嵌入很多關係的子對象回調。例如: class User embeds_many :phones, cascade_callbacks: true end class Phone embedded_in :user, inverse_of: :phones before_save :callback_after_save def callba

    0熱度

    2回答

    我有一個基於組合索引構建的查詢,並且我已經從mongo shell驗證此查詢可以作爲僅索引查詢運行。 輸出: db.merchants.find({st:{"$regex" : "cr", "$options": "i"}}, {n:1, _id:1}) { "n" : "Crab shack", "_id" : ObjectId("51c908cc1925f3ca51000001") } {

    1熱度

    1回答

    我有以下的MongoDB/Mongoid文件: #<Event _id: 51e406a91d41c89fa2000002, namespace: :namespace, bucket: "order_created", data: { "order"=>{ "id"=>100, "deleted_at"=>nil,

    0熱度

    2回答

    我最近爲Heroku託管的網絡應用程序添加了SSL,但現在我無法在本地運行應用程序,瀏覽器只是永久旋轉,然後在終端中出現此錯誤 - $ rails s => Booting WEBrick => Rails 3.2.12 application starting in development on http://0.0.0.0:3000 => Call with -d to detach

    1熱度

    1回答

    我一直在網上尋找解決我的問題。我正在使用Mongoid向MongoDB寫入一組數據。 我試圖做一個批量插入與mongoid如下: class Geonode include Mongoid::Document include Mongoid::Timestamps embeds_one :location embeds_one :transport e

    0熱度

    1回答

    我遇到了一個問題,我正在努力解決優雅。我更熟悉RDBMS,所以我做事情的方式可能並不理想。 我在做什麼: 我不得不跟蹤HABTM協會中的項目。此外,還有一個計數條件,因爲只有「活躍」的項目纔會被計數。我已成功使用關聯回調追蹤集合中的添加和刪除。 問題: 我還通過將相反實例的id設置爲隱藏字段的形式將項目添加到集合通過窗體。這工作正常,但問題是,這會將相反的實例直接添加到集合中,而不會調用回調(舊時

    3熱度

    2回答

    我有一個名爲Equipment的Mongoid文檔,它可以嵌入多個Question文檔。這裏是文檔模式: class Equipment include Mongoid::Document include Mongoid::Timestamps field :description field :modelNumber field :title

    0熱度

    1回答

    在ROR和mongoid作爲映射器,我碰到這類模型傳來: class StockPrice include Mongoid::Document include Mongoid::Timestamps field :stock_id, type: String field :price, type: Float index :stock_id => +1, :updated_at =>

    0熱度

    1回答

    後不會被刪除,我有以下兩種模式: class Customer include Mongoid::Document include Mongoid::Timestamps embeds_many :locks, class_name: "Lock" accepts_nested_attributes_for :locks, allow_destroy: t