Replies: 1 comment
-
// CREATE THE SCHEMA
const userSchema = new Schema(
{
name: { type: String },
data: {
attributes: [
{
code: String,
type: { type: String }, // <-- change here to tell Mongoose that `type` is a path, not saying that `attributes` is array of strings
name: String,
value: String,
},
],
},
},
{
timestamps: true,
},
); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Model:
creation:
got error:
reproduction:
https://codesandbox.io/p/devbox/mongoose-forked-tqc962
what I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions