Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I dont fully understand your question., like</p> <ol> <li>what is the problem you are facing right now using mongo and MySQL in same app, and </li> <li>whats the reason for going multiple rails app dealing with different dbs.</li> </ol> <p>Though am not an expert in ruby &amp; rails(picked up few months ago), i like to add something here.</p> <p>I am currently building the rails app utilizing both mongo and MySQL in the back end. Mongoid &amp; ActiveRecord are the drivers. MySql for transactions and mongo for all other kind of data (geo spatial mainly). Its just straight forward. You can create different models inheriting from mongoid and activerecord. </p> <pre><code>class Item include Mongoid::Document field :name, :type =&gt; String field :category, :type =&gt; String end </code></pre> <p>and</p> <pre><code>class User &lt; ActiveRecord::Base end </code></pre> <p>And you can query both the way same way (except complex sql joins, also mongoid has some addition querying patterns for Geo spatial kind of queries)</p> <pre><code>Item.where(:category =&gt; 'car').skip(0).limit(10) User.where(:name =&gt; 'ram') </code></pre> <p>Its a breeze. But there are some important points you need to know</p> <ol> <li>Create your Active record models before the mongoid models. Once mongoid is activated (on rails g mongoid:config - mongoid.yml added) all the scaffolding , and generations works toward mongo db. Otherwise every time you need to delete the mongoid.yml before creating the Activerecord models</li> <li>And don't use mongoid in a relational way. i know mongoid provides lot of options to define realtions. Like Belongs_to relations stores the refernece id's in child documents. Its quite opposite to the mongo DbRef. Its greatly confusing when leaving the mongo idioms for the favour of active record feel. So try to stick with the document nature of it. Use embed and DbRef whenever necessary. (may be someone corrcet me if am wrong)</li> </ol> <p>Still Mongoid is a great work. Its fully loaded with features.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload