top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to use MongoDB instead of SQLite3 for rails?

+2 votes
939 views

I'd like to continue with Rails but I wonder how to switch from SQLite3 to MongoDB.

posted Oct 21, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You should search for "mongoid" in rails. Mongoid is one of the adpater for mongodb. You can below link to get started
http://mongoid.org/en/mongoid/docs/installation.html

answer Oct 21, 2014 by Dewang Chaudhary
Note that since this isn't SQL, it won't be as simple as just changing your database,yml (as it would be if switching to postgres) - you'll have to regenerate the models.
Similar Questions
+1 vote

I would like to know if this problem is occurs only with me? I was unable to get Mysql2 ou Sqlite3 working with Ruby and rails.

-ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
-Rails 4.0.0.

I tried several tutorials but no one work for me.

See same examples, for sqlite3:
https://github.com/luislavena/sqlite3-ruby/issues/82
http://stackoverflow.com/questions/15480381/how-do-i-install-sqlite3-for-ruby-on-windows

And many others.
I can install de gems but When a run the app it´s simple crash.

0 votes

I was writing a Python script for getting the user stats of a website(Specifically codereview.stackexchange). I wanted to store the stats in a database. I found Python3's sqlite3 library. I found that I needed sql commands for using it.

I have tried sql.learncodethehardway but it isn't complete yet. I tired looking on stackoverflow's sql tag also but nothing much there. Can someone suggest me better resources for learning sql/sqlite3?

+1 vote

We recently looked at mongoDB a bit. I was discussing using mongoDB with active record but was told that maybe there are other or better options. Can someone comment on that ?

Also, someone suggested storing a ruby array directly inside of a record where I would have opted for the array to be a separate set of records in active record using has_many and belongs_to .. It seemed to me that how I search on those child records would be a big factor but I soon realized I need to find out what are the options. Do people store arrays and hashes directly in mongo DB fields or is that not the best way to go ?

0 votes

Mongodb 3 provides the maxTimeMS() option. Is it possible to apply this through the Ruby Driver 2.2 and Mongoid 5?

...