Blog Archives

Connect with MongoDB on separate EC2 Instance

You need to open mongoDB port to world so that you can listen inbound traffic. To do so: In instance security group -> Inboud Open 27017 port or whatever port on which your mongoDB is currently running. Type Protocol Port

Tagged with: , , ,
Posted in amazon, EC2, mongodb, mongoid

mongoid group by query

stages = [ { “$match” => { column_name: “Value” } }, { “$group” => { “_id” => { “name_of_your_choice”=>”$column_name”, “year” => { “$year” => “$column_name” }, “month” => { “$month” => “$column_name” }, “day” => { “$dayOfMonth” => “$column_name” },

Tagged with: , ,
Posted in mongoid

Mongo::Error::NoServerAvailable OR mongod stoped working rails OR Insufficient free space for journals, terminating

First I tried to remove mongod lock, but it did not worked: sudo rm /var/lib/mongodb/mongod.lock sudo service mongodb restart Then I tried to change permission for “/tmp” folder ls -lh /tmp chown root:root /tmp chmod 1777 /tmp sudo service mongodb

Tagged with: , , ,
Posted in mongodb, mongoid

User does not respond to ‘devise’ method

In config/initializers/devise.rb Replace this: require ‘devise/orm/active_record’ with this: require ‘devise/orm/mongoid’ Replace content inside block: Devise.setup do |config| … require ‘devise/orm/mongoid’ … end

Posted in Devise, mongoid

Connecting rails app with remote mongodb server [mongodb ubuntu]

Problems faced: P1. My DB server is running but ping not working correctly: To ping an EC2 instance, you need to allow ICMP traffic in the instance’s security group. See Why can’t I ping my instance in the EC2 FAQ.

Tagged with: , , ,
Posted in amazon, mongodb, mongoid