Skip to main content

Rails 4.0 with MongoDB and Mongoid Discussion

General • Asked by Chris Oliver
Aad37b5f7116c8d1f547d23b37566032

> rake
rake aborted!
Don't know how to build task 'default'

(See full trace by running task with --trace)


69cb4c5e4dc19ad198008eb58834770a

Yo. The ActiveRecord issue is a bit easier than you have described. When you create your app, just add the -O switch, and it will skip all AR.

rails new myapp -O

Ce795239ba5dd2384fc2f88ffaff5451

Fantastic. I'll update the post.


C2e3a7afb3efd06abb65fc3d31b1ea94

I followed this tutorial on Rails 4.02 with latest Mongoid from Git. In my case it's also required to add this line in initializers code:
Mongoid.load!("path/to/your/mongoid.yml")


F2188e1e69fbe1441e867cb57bd45603

Maybe it's just me, but there doesn't seem to be a date on this post. Seems like it might be relevant, given the obviously time-sensitive nature of edge development.

Ce795239ba5dd2384fc2f88ffaff5451

It was posted about 3 months ago. I haven't kept up on Mongoid's development, but it looks like they've been working closer to 4.0.0: https://rubygems.org/gems/m...

Looks like it's pretty questionable as to eventual compatibility with Rails 4 (https://github.com/mongoid/... so these instructions should still be pretty up-to-date.

F2188e1e69fbe1441e867cb57bd45603

Yeah, I'm trying it out.

Why not just timestamp posts?

Ce795239ba5dd2384fc2f88ffaff5451

Just redesigned the blog, forgot to add it in. :)


38cc4de0f4a523c3a919e65cde20ddb0
Ярослав Ничка

Very useful, thanx!


4dac57b06316a0ae43fccbc4365f5c7f

In my case, I changed in gemfile "gem 'mongoid', '~> 4', github: 'mongoid/mongoid'" to "gem 'mongoid', github: 'mongoid/mongoid'" and then run bundle install. This worked for me


653939e3158ef1c0e8ed15cb1157e710

I have two collections in mongo. Can I use mongoid to join them based on their common field. Can I get some tutorial.


01cc74e3257c8bcc3e4ae13274c01c8a

One Quick Question

Your Article looks intresting,...

Can you post some Usecases regarding, When one should use Mongodb with rails?

Besause I think with rails if your using Mongodb,

Rails makes it relational in many places using relations between models.

Its hard to write code with zero relations

Ce795239ba5dd2384fc2f88ffaff5451

That's up to you to make sure you've got a project that's worth using with it. There are lots of good articles on it that you can check out:

http://java.dzone.com/artic...
http://docs.mongodb.org/eco...
http://www.sarahmei.com/blo...


479e8ecafa2b77dd13bccebaa85b4dd4

Good Post, But gem 'mongoid', git: 'https://github.com/mongoid/... is working perfect...Thanks,


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 18,000+ developers who get early access to new screencasts, articles, guides, updates, and more.

By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

More of a social being? We're also on Twitter and YouTube.