Please read for an updated status on RailsCasts:
Learn more or hide this
Thanks Ryan great episode as always.
What i find a bit hard to implement in document base DB are trees and has_many through associations.
Radha, check out my 2nd favorite ORM in the world: MongoMapper! 2nd only to Active Record! :)
However, there's been more out-of-the-box support for mongoid among popular authentication gems... If you want to introduce that type of logic with MongoMapper while doing very little typing in your text editor and still watch it all work, I recommend checking out Sorcery as a starting point. Sorcery jives with MongoMapper way better than things like Clearance or Devise. Obviously there's a gem for that but we've lost track of the the point here, because the real question we ought to consider is the extent ORMs are appropriate for engaging NoSQL data structures from Ruby. Maybe I'm missing something but it's tough for me to distinguish the key value store pattern from array or the ruby hash key/entry. Isn't MongoDB's driver the most natural map to data objects we handle in ruby? I tell you all, if it weren't for free validation methods and some active model hooks I wouldn't be able to care about Mongo ORMs.
Akshay Rawat 's post that refers to a video where all of my worries are presented along the reasons why I havent done much more than design and prototypes apps with document based DB and never in production.
Fyi, the mongoid_ancestry gem provides nearly the same feature set as the ancestry gem for active_record, but for mongoid. It has some gotchas but worth to check out.
An interesting talk at RubyConf on why Diaspora went from MongoDB to MySQL.
Well i have had the same problems she is talking about at the design face, i have never implemented document base db because of all she said. Still i think things are changing because most node.s projects use mongodb and node.js's community is growing very fast.
No one data store to rule them all. Different ones for different big data problems in the same application.
one data store
They did wrong. That's true, MongoDB is not very good for abstracting complex social network structures. But MySQL is not any better either! For that class of problems the best solution is graph database. http://www.infoq.com/presentations/emil-eifrem-neo4j. (for Rails: http://neo4j.rubyforge.org/guides/rails3.html)
Funny. We switched from MySQL to MongoDB and Monogid about a year ago for the same basic reason they moved the other way. :)
We had SQL migrations and "strongly typed schema" as a major source of friction in a system that's quickly evolving and iterating. I miss joins but there is really only a single query in our system where it is a significant problem.
Just wanted to mention that in the Mongo Shell you can use .pretty() at the end of your query, so you can get the pretty-printed output in mongo shell. This is similar to what you would get with "awesome_print" in irb or the rails console.
Another great screencast Ryan!
If anyone's looking for a good book to read on DBs, PragProg's 7 Databases in 7 Weeks is excellent. Which reminds me I need to finish it!
+1 recommend 7 Databases.
Hey, I keep getting these error on everything I try to do, products index, show and when I try to save a product. Any ideas ?
ActionView::Template::Error (undefined method `' for nil:NilClass):
12: <% @products.each do |product| %>
14: <td><%= product.name %></td>
15: <td><%= product.price %></td>
That is because mongoid gem only works with Ruby 1.9.3
See this link for more details:
Thank you, problem solved.
Great episode! The only problem I have is dealing with many-to-many relations – sadly that doesn't seem to work so well with rails.
Ryan, great revision to a classic railscast! quick question, are you using a different file browser for Textmate? I think i remember you saying something about it in a different episode, but forgot which one.
I recommend Mongify if you want to create a branch of your app and move your data over from MySQL to MongoDB (and Mongoid). It saved my life when I migrated in that direction last year.
I'm trying to use mongoids versioning system (also looking at mongoid-history) but am having difficulty figuring out a basic undo and list of versions.
Are there any good tutorials out there on this?
is there possible to have a final solution for the limit function issue?
Basically for example, how can I get the first 3 users from my users records?
thanks for your help
How do you replace the ugly id and replace it with a seo friendly url?. lol it's at the end of the video, thank you Ryan for always thinking about that!
I don't know any more about MongoDB other than what's covered here. How would I decide whether it's relevant to my app and I should go learn more? Right now my app uses MySQL.
Once I become knowledgeable about MongoDB, how would I decide whether using MongoDB is the right choice?
Check out http://www.mongodb.org/display/DOCS/Use+Cases#UseCases-WhenshouldyouconsiderusingMongoDB%3F
Can you please show how to display the reviews?
I can't figure out how to access embedded documents like reviews in this case...
hope you're enjoying you're well deserved time off. Just thought I should add that the way to ensure you have the most recent version of mongoid would be to write
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git'
This is particularly important as the gem available from rubygems.org seems to have some problems with Rails 4 whereas the github version works perfectly with it.
gem 'mongoid', github: 'mongoid/mongoid'
I am trying to build a PoC (proof of concept) for 1-N relationship with Mongoid following this particular tutorial. I have built 'Blog' & 'Comment' controller. But everytime, I am trying to add a new comment I run into an exception.
More details, here http://stackoverflow.com/questions/23506752/mongoid-1-n-relationship-one-to-many-in-rails-4
can someone help me out? Thanks in advance.
And the source code is here Link
Worth noting that at the end of products_controller.rb you'll need to add :released_on to get through the param filter,
params.require(:product).permit(:name, :price, :released_on)
First sign in through GitHub to post a comment.