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

  • Home
  • SEARCH
  • 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 8517783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:48:04+00:00 2026-06-11T05:48:04+00:00

I am trying to use node.js with mongodb and following the tutorial at http://howtonode.org/express-mongodb

  • 0

I am trying to use node.js with mongodb and following the tutorial at http://howtonode.org/express-mongodb

The code for opening the connection is

ArticleProvider = function(host, port) {
 this.db= new Db('node-mongo-blog', new Server(host, port, {auto_reconnect: true}, {}));
 this.db.open(function(){});
};

However i cannot see any connections being closed.
But when i see the logs on the mongo console, i can see that are connections which open and they close after some time.

Does the connection close automatically? Will it be a problem when a large no of clients try to access the server? Where should the connection be closed?

Thanks

Tuco

  • 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-06-11T05:48:06+00:00Added an answer on June 11, 2026 at 5:48 am

    In that example application, only a single ArticleProvider object is created for the application to share when serving requests. That object’s constructor opens a db connection that won’t be closed until the application terminates (which is fine).

    So what you should see is that you get a new mongo connection each time you start your app, but no additional connections made no matter how many clients access the server. And shortly after you terminate your app you should see its connection disappear on the mongo side.

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

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to use the GNU Scientific Library (GSL) http://www.gnu.org/software/gsl/ in QtCreator. How
I am trying to use node-http-proxy to proxy my site to another site eg
i'm using node 0.4.11 express 2.4.6 mongodb 1.8.3 mongoose 2.1.2 connect-mongodb 1.0.0 and trying
I'm trying to use Express in node, install everything okay, compiled, got npm and
I'm trying to use Node.js to create a zip file from an existing folder,
I'm trying to use quoted text in one of node's attributes: var network_json =
js.I am trying to create a file upload using node.js and mongodb.I am getting
I'm trying to use jasmine-node for our testing of js files. We've written some
Trying to use exportDoc.Root.Elements(string).Where(node => !(node.Element(product).HasElements) || node.Element(product).Element(type).Value != product).Remove(); to remove the nodes

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.