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 9212439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:31:32+00:00 2026-06-18T01:31:32+00:00

I want to abstract certain MongoDB queries/documents using classes. Basically I think the way

  • 0

I want to abstract certain MongoDB queries/documents using classes.

Basically I think the way is to somewhere (an own class?) create the connection and use this connection(pool) in various Classes. But how would I do this code-wise. For example I am not sure, when I use a MongoDBConnectionClass and initialize the connection in the constructor how to make sure I wait for the connection to be established to continue using it somewhere else.

I think I am doing something wrong here. Here a schema to maybe better understand what I mean

MongoDBConnection(Class?)
+---- Class1+ # eg. Book
+---- Class2+ # eg. Library
+---- Class3+ # eg. Dust
            |
            +-- Library1+ # eg. New Book Release
            +-- Library2+ # ...
            +-- Library3+ # ...
                        |
                        +-- App1
                        +-- App2
                        +-- App3

Oh an CoffeScript answers would be great, but JS of course works as well.

  • 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-18T01:31:33+00:00Added an answer on June 18, 2026 at 1:31 am

    I use this pattern in my tutorial (will be out soon)

    https://github.com/christkv/tic-tac-toe-steps

    If you look at the model and controllers I wrap the actual function with the db object.

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

Sidebar

Related Questions

I have one abstract class -let's say myBase. And I want all the classes
I have an abstract base class and want to implement a function in the
I want to call a redefined private method from an abstract parent class. I
I have an abstract class with a pure virtual function f() and i want
I am making an abstract-base-class and was thinking I might want a pure virtual
Suppose I want to create trees of a certain set depth, that is, the
I am trying to create a custom shape class, that is basically a hexagon,
I have a class // i want an abstract class. class Foo { public:
Introductory OOP question for you: Situation: I want an abstract class with a public
Is there a feasible way to get my own code run whenever any class

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.