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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:16:53+00:00 2026-06-17T06:16:53+00:00

Thanks in advance for your help on this, it’s much appreciated! I’m using Node.js,

  • 0

Thanks in advance for your help on this, it’s much appreciated!

I’m using Node.js, MongoDB and Mongoose in a new project and I’m simply trying to find() the documents in a database. For brevity I’ll just include the Mongoose code below (I’m not doing much more than this anyway right now):

var mongoose = require('mongoose');

mongoose.connect('mongodb://<username>:<password>@<sub-domain>.mongolab.com:<port>/<db>');

var schema = { email_address: String, invite: String }
  , Users = mongoose.model('Users', new mongoose.Schema(schema));

console.log(Users.findOne({ 'email_address': 'jonathon@foo.bar' }, function(err, doc) { return doc; }));

I’m quite sure that should just echo the returned doc to the Node.js console (Terminal) but instead I’m getting this:

{ options: { populate: {} },
  safe: undefined,
  _conditions: { email_address: 'jonathon@foo.bar' },
  _updateArg: {},
  _fields: undefined,
  op: 'findOne',
  model: 
   { [Function: model]
     modelName: 'Users',
     model: [Function: model],
     options: undefined,
     db: 
      { base: [Object],
        collections: [Object],
        models: {},
        replica: false,
        hosts: null,
        host: '<sub-domain>.mongolab.com',
        port: <port>,
        user: '<username>',
        pass: '<password>',
        name: '<db>',
        options: [Object],
        _readyState: 2,
        _closeCalled: false,
        _hasOpened: false,
        db: [Object] },
     schema: 
      { paths: [Object],
        subpaths: {},
        virtuals: [Object],
        nested: {},
        inherits: {},
        callQueue: [],
        _indexes: [],
        methods: {},
        statics: {},
        tree: [Object],
        _requiredpaths: undefined,
        options: [Object] },
     collection: 
      { collection: null,
        name: 'users',
        conn: [Object],
        buffer: true,
        queue: [Object],
        opts: {} },
     base: 
      { connections: [Object],
        plugins: [],
        models: [Object],
        modelSchemas: [Object],
        options: {},
        Collection: [Function: NativeCollection],
        Connection: [Function: NativeConnection],
        version: '3.5.4',
        Mongoose: [Function: Mongoose],
        Schema: [Object],
        SchemaType: [Object],
        SchemaTypes: [Object],
        VirtualType: [Function: VirtualType],
        Types: [Object],
        Query: [Object],
        Promise: [Function: Promise],
        Model: [Object],
        Document: [Object],
        Error: [Object],
        mongo: [Object] } } }

Obviously I’ve just obfuscated my real credential with the <username> bits, they are all correct in my code.

The database does have a document in it that would match the condition though even removing the condition from the findOne method yields no results!

I’m fairly new to Node.js so I you could explain your answers so I know for next time it’d be a great help! Thanks!

  • 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-17T06:16:54+00:00Added an answer on June 17, 2026 at 6:16 am

    I totally forget, Node.js is asynchronous so the line console.log(Users.findOne({ 'email_address': 'jonathon@foo.bar' }, function(err, doc) { return doc; })); is indeed echoing to the console though no documents have been returned by the DB yet!

    Instead the console.log method should be inside the find‘s callback, a la:

    Users.find({}, function(err, doc) { console.log(doc); });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

thanks in advance for your help. I'm using this piece of code to replace
First off, thanks in advance for your help. This issue is driving me nuts.
Hi everyone and thanks in advance for your help. This is the situation: I'm
Thanks in advance for your help. I'm new to JSON and I've been trying
Thanks in advance for your help. This list is to update an existing record,
thanks in advance for your help. I'm working on this site and have an
Thanks in advance for your help. I have a need within an application to
Thanks in advance for your help experts. I want to be able to copy
Hi thanks in advance for your help. I'm just getting started learning Python and
Thanks in advance for any help you can provide on this issue! I manage

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.