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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:48:18+00:00 2026-05-30T00:48:18+00:00

I am trying reference another object in a model in node, User = new

  • 0

I am trying reference another object in a model in node,

User = new Schema({
        username: {
            type: String,
            index: {unique: true}
        }
});

Idea = new Schema({
        Creator: {
            type: User
        }
});

but I get this error Undefined type at "creator" Did you try nesting Schemas? You can only nest using refs or arrays. I believe I want to use refs, but could not find documentation on it, can some one help me out. 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-05-30T00:48:20+00:00Added an answer on May 30, 2026 at 12:48 am

    I found out the answer to my own question here it is.

    User = new Schema({
        username: {
            type: String,
            index: {unique: true}
        }
    });
    
    Idea = new Schema({
        Creator: {
            type: Schema.ObjectId,
            ref: 'User'
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Type.InvokeMember(String, BindingFlags, Binder, Object, array []) with the default binder.
I'm trying to get a reference to a group of ArrayLists into another object
I'm trying to reference another object I've defined in a Spring config file from
I'm trying to model a user which could be invited by another user. So
Basically what I'm trying to achieve is to make the object reference another object
I have an Expression that converts one type of object to another type. The
I'm trying to reference an object loaded via a classloader in a class that
I am trying to reference the jQuery library in my master page like so:
We are trying to reference a certificate for a client endpoint configuration in our
I am trying to reference some child entities with part of the parents composite

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.