문제

More specifically, I am thinking of using PostgreSQL (ActiveRecord) and MongoDB (Mongoid) in a single Rails 4 app.

Also, will associations between models work? Something like

class Customer < ActiveRecord::Base
    has_many :orders
end

class Order
    include Mongoid::Document
    belongs_to :customer
end

I am aware that ActiveRecord and Mongoid can coexist, but is that a good idea?

도움이 되었습니까?

해결책

I would do some hard thinking and try to choose one of the databases, even if you can make them work together technically. You have to think past programming and take a bigger view. One day your app will be in production, I assume. THis implies 2 different backup solutions, 2 different monitoring solutions, double the training for the ops, etc.

Alex Lerner

다른 팁

It's absolutely OK.

If you application have different kind of data and using mongodb improve performance, why not?

OR:

Your application is market. Products in your market have common columns - price, name and etc. Put them in postgresql. Besides, products have many params are not common for all (computer - volume of hdd, monitor - size of display and etc). These data you can store using mongodb.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top