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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:10:25+00:00 2026-06-06T22:10:25+00:00

I defined: a mongoose schema (Type1) to save an object 2 others that extends

  • 0

I defined:

  • a mongoose schema (Type1) to save an object
  • 2 others that extends the first schema (Type2 and Type3) with other properties (content, and others…).

When I load an object Type1 saved as Type 2 from the database, I can access all properties except for one (The content property). But if I do an object.toString() the property does exist.

How is this possible?

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-06T22:10:26+00:00Added an answer on June 6, 2026 at 10:10 pm

    Properties of mongoose objects are always the same as its schema. Loaded as a Type1 schema will have properties of Type1 schema.

    The underlying data may be bigger (because of Schema inheritance or simply because someone stored more data directly in MongoDB), but you cannot access it from the level of Type1 using only properties. The method you can try using (didn’t test it) is object.getValue('content');. Also, I think that object._doc holds the real data from DB.

    One last thing: object.toString is actually overriden and it shows inspect of entire object. That’s why you see the underlying data.

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

Sidebar

Related Questions

I defined a global variable that is called from other view and it is
I'm creating a bot using mongodb and mongoose.js. I've defined a schema and am
I defined an object which contains properties in code-behind and, want to set the
The docs simply say or define custom schema (non-juggling), for example, mongoose. Please note,
I'm using Mongoose, MongoDB, and Node.js. I would like to define a schema where
User Defined Function (UDFs) are functions that one can program and can be dynamically
I defined two panels in viewport: a main panel which is non-floating, the other
I defined a webpage to use iso-8859-1 like the following: <meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
Does anyone know how to test Mongoose Validations? Example, I have the following Schema
I'm attempting to save an object to my database; I know the database is

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.