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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:05:43+00:00 2026-06-17T10:05:43+00:00

I am trying to get node.js to write to the console the data in

  • 0

I am trying to get node.js to write to the console the data in the table, my other tables work.

Whenever I try I get the following output:

NO ERROR!
QUERY:{"emitted":{"complete":[[]]},"_events":{}}

Am I missing something in the Schema definition?
Any help would be appreciated.
– Eric

The following is from the mongo shell :

> db.userAssessments.find({})
{ "accountId" : "509683edcb884b0000000001", "created" : ISODate("2013-01-12T03:31:20.723Z"), "_id" : ObjectId("50f0d9084469766bb7000001") }

This is my js:

var userAssessmentsSchema = new mongoose.Schema({
    accountId : String,
    created : Date,
    id: String
});

ANALYZER.userAssessments = mongoose.model('userAssessments', userAssessmentsSchema);
ANALYZER.analyzeAssessment = function() {
    var query = ANALYZER.userAssessments.find({}).exec(function(err, ass) {
        if (!err) {
            console.log("NO ERROR!");
            console.log("QUERY:" + JSON.stringify(query));
        } else {
            console.log("ERROR!");
        }
    });
};
  • 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-17T10:05:44+00:00Added an answer on June 17, 2026 at 10:05 am

    The result of the find query is passed to the exec callback as the second parameter (ass in your code). The return value you assign to query is the Promise object returned from exec.

    UPDATE

    Your other problem is that Mongoose pluralizes and lower-cases the model name to derive the collection name if you don’t provide one. To make it use the userAssessments collection instead of userassessments you need to provide that collection name in the mongoose.model call.

    So your code should be like this instead:

    ANALYZER.userAssessments = mongoose.model(
        'userAssessments', userAssessmentsSchema, 'userAssessments');
    
    ANALYZER.analyzeAssessment = function() {
        ANALYZER.userAssessments.find({}).exec(function(err, ass) {
            if (!err) {
                console.log("NO ERROR!");
                console.log("QUERY:" + JSON.stringify(ass));
            } else {
                console.log("ERROR!");
            }
        });
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to POST data from an iOS app to Node.js/Express. I cannot get
I am trying to get the node ref of file uploaded to default root
I am trying to get the 4 node riak setup working on my os
I am new to hadoop and trying to get a single node setup of
I'm trying to get npm to install node-gitteh as a dependency via npm install
I am trying to get rss feed and push the node value to an
I'm trying to write an image server that uses node.js to store images on
I'm trying to get a node.js server to send css files. I'm modifying this
I am trying to get a python script to write to a serial port
I'm trying to get a simple (!) digest authentication working with node js using

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.