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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:39:35+00:00 2026-06-13T00:39:35+00:00

I am querying my mongodb using mongoose, but i don’t understand why the returned

  • 0

I am querying my mongodb using mongoose, but i don’t understand why the returned sub docs are just of type Object, instead of JSON.

Using

  hero.find({} ,{'deck' : {$elemMatch:{name:'Guard Tower'}}}, function(err, tower) {
    console.log(tower);
  }

returns

[ { _id: 507ac406ba6ecb1316000001,
    deck: 
     [ { name: 'Guard Tower',
         description: 'This tower shoots stuff.',
         cost: 13,
         sellValue: 7,
         radius: 180,
         speed: 40,
         dmg_min: 0,
         dmg_max: 0,
         actual_height: 40,
         sprite: 'guardtower_red.png',
         anim: [Object],
         size: [Object],
         projectile: [Object],
         upgrade: [Object] } ] } ]

Subdocument like anim, size, projectile, upgrade, is Object, i need the information nested, how can i get the information? Without making another query?

  • 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-13T00:39:41+00:00Added an answer on June 13, 2026 at 12:39 am

    The all docs and subdocs are objects in JavaScript. It’s just that console.log uses the default depth of 2 when calling util.inspect to format your document for output. You can output all levels of the document by calling util.inspect yourself:

    var util = require('util');
    
    hero.find({} ,{'deck' : {$elemMatch:{name:'Guard Tower'}}}, function(err, tower) {
        console.log(util.inspect(tower, false, null)); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use MongoDB in my rails application with Mongoid mapper. But I don't understand
I'm new using MongoDB, and I don't know how to solve the next problem:
I'm trying to use the sort feature when querying my mongoDB, but it is
I'm beginning with MongoDb and nodejs (using mongoose). I have a collection of Stories
Is there a way of querying array fields within documents in mongodb using more
I am using 10Gen .net driver for MongoDB and querying objects that has empty
When querying for a object by id or returning a list of objects using
I am querying my mysql-db using PDO, with a plain SELECT * FROM Invoices
I'm querying an MFC implemented COM object that is implemented as follows: class CA
I'm querying the gmail feed using XmlReader and XDocument and I'm running in to

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.