Answer the question
In order to leave comments, you need to log in
How to implement an Array with objects in Schema Mongoose?
How to implement an Array with objects in Schema Mongoose so that there are no cast errors?
I tried a lot, the result was getting the desired one, but immediately after the result, a CastError error occurred.
Mongoose Schema Mongoose
entry example . There is immediately more a question of what to enter here, and not what I entered and it didn’t work out for me :
And when I tried my attempts, I got a casterror error
I tried to do friends: [{ }],friends: [{ user: String }],friends: [{ _id: false,user:String}] , nothing helped, I don't know what
to do anymore
Answer the question
In order to leave comments, you need to log in
friends: [
{
id: { type: String, required: true, unique: true },
},
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question