I trying to use MongoDB with Rails (I never tried MongoDB before). And I want to display the queries made by mongomapper in the rails console or the rails server (like ActiveRecord does)
Is there a way ? Thank you!
I trying to use MongoDB with Rails (I never tried MongoDB before). And I want to display the queries made by mongomapper in the rails console or the rails server (like ActiveRecord does)
Is there a way ? Thank you!
You can turn on logging by passing a logging instance to the ruby driver when creating the connection like this:
MongoMapper.connection = Mongo::Connection.new('localhost', 27017, :logger => Rails.logger)
Documentation for using the logger is here: http://railstips.org/blog/archives/2009/10/09/more-mongomapper-awesomeness/
Though Mongoid is definitely worth taking a look at. It supports logging as well: http://mongoid.org/en/mongoid/docs/installation.html#logging
mongoid
gem is invalid. I clicked on it and it shows "Sorry, we can't find that page. The page might have been moved or deleted." –
Kiblah © 2022 - 2024 — McMap. All rights reserved.