keystonejs / keystone-classic

Node.js CMS and web app framework
http://v4.keystonejs.com
MIT License
14.65k stars 2.21k forks source link

[HELP] What keystone.Field.Types to use if the value is a DBRef #4916

Open randolphpebenito opened 5 years ago

randolphpebenito commented 5 years ago

I have a record which has value DBRef (company key)

{
     "firstname": "John",
     "lastname": "Tucker",
     "company" : DBRef("company", ObjectId("580ed4023ce70e5f8012875b"))
}

Sample Model Code:

User.add({
  firstname: {type: String },
  lastname: { type: String  },
  company: { type: <What type to put here>, ref: 'company' }
});

What's the correct code to resolve this one? The record was created using the Spring Boot @DBRef annotation

Basically, I'm creating a CMS to easily manage the records.

Can anyone help me with my problem? Or does the DBRef type already exists in keystone?

Thanks!