Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6545995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:39:17+00:00 2026-05-25T11:39:17+00:00

I am deploying my first little app with MongoDB and Mongoid as a driver.

  • 0

I am deploying my first little app with MongoDB and Mongoid as a driver.

What is the right secure way to use MongoDB in production?

I mean in the development I have just started mongod and that’s it – no username or password needed and that looks unsecure.

Also Mongoid sets default configurations

production:
  host: <%= ENV['MONGOID_HOST'] %>
  port: <%= ENV['MONGOID_PORT'] %>
  username: <%= ENV['MONGOID_USERNAME'] %>
  password: <%= ENV['MONGOID_PASSWORD'] %>
  database: <%= ENV['MONGOID_DATABASE'] %>

How should I configure this options and entire MongoDB on my production server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:39:18+00:00Added an answer on May 25, 2026 at 11:39 am

    To create a production environment where you need to use a username and password to connect:

    In the mongo console:

    // Add an Admin User (to the admin db)
    use admin
    db.addUser("theadmin", "anadminpassword")
    
    // Use your database
    use supercool
    
    // Add a user (to your database)
    db.addUser("joe", "passwordForJoe")
    
    // show all users:
    db.system.users.find()
    
    // add readonly user (kinda cool)
    db.addUser("readonly", "passwordForJoe", true)
    

    Now, all connections to your mongodb will require authentication — http://www.mongodb.org/display/DOCS/Security+and+Authentication

    Also: you can consider using your linux firewall to only allow 27017 from your web server(s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my server when deploying the app for the first time, I ran rake
First some background information: We have three environments for our EJB3 application: test, development
I'm working on deploying my first Rails application right now, and somewhere along the
I have a basic rails3 app that I am deploying on site5. I have
Let me first describe the way I am planning to use activemq for my
Deploying an app first time with Capistrano, but having problem running the cap deploy:update
I'm deploying a new Rails app to Heroku. This is the first time I've
I have written my first java applet and get errors when deploying it on
I'm deploying my first app on Heroku, and I want to push a file
Im having problems deploying my django app to heroku in the first part, heroku's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.