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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:21:26+00:00 2026-06-13T17:21:26+00:00

In mongojs, when you do: var birds = db.birds.find(searchTerm, callback); …how do you pass

  • 0

In mongojs, when you do:

var birds = db.birds.find(searchTerm, callback);

…how do you pass arguments to the callback? I’ve tried bind, as in:

birds = db.birds.find(searchTerm, app.get('getBirds').bind(res));

…but to no avail. Just fyi I’m trying to pass the response object of the GET route so that the callback can render using res.send(results).

The other option is to set app.set(‘res’: res); and call app.get(‘res’) from the callback – I’m not sure this is a good idea. It works, but it doesn’t obey the events loop model too well – I think the request back to the app may be costly? Any help would be gratefully accepted. 🙂

  • 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-13T17:21:27+00:00Added an answer on June 13, 2026 at 5:21 pm

    You typically do this by wrapping the callback function call in an anonymous function:

    db.birds.find(searchTerm, function (err, birds) {
        callback (err, birds, res);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have MongoJS query call: db.users.find({username:eleeist},function(err, docs) { console.log(docs); }); The docs variable looks
I'm having some weird performance issues with MongoDB. First I tried to get about
i try to find a way to use vars for mongojs collections. The data
I have been trying to retrieve the data using the MongoJS driver for node.js.The
Consider the following nodejs code: db = require('mongojs')('database', ['users, sessions']); db.users.insert( { 'email': email,
How do I return an array from a mongojs query. I have the below
I am trying to get my head around creating a non-blocking piece of heavy
Am running MongoDB 2.2 on Ubuntu and if I run: sudo mongod I get
If I try to run mongodb shell with the mongo command alone, I get:
I am trying to find the size of all chunks in one of my

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.