Reputation: 2215
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?
Upvotes: 1
Views: 166
Reputation: 2064
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
Upvotes: 1
Reputation: 26
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.
Upvotes: 1