I want to use id, model and other fields. But I can't because reserved fields are substituted at the output, which are not described anywhere. That is, I have to guess that these fields cannot be used. How can I fix this situation? The example is copied from the official site, I just added a couple of fields.
I tried to use: interface with Document(official documentation not recommended to use),
import { Vehicle } from '~/shared/typings/vehicle'
import { Schema, model, connect } from 'mongoose'
type IUser = {
id: string
name: string
model: string
email: string
avatar?: string
}
// 2. Create a Schema corresponding to the document interface.
const userSchema = new Schema<IUser>({
id: { type: String, required: true },
name: { type: String, required: true },
model: { type: String, required: true },
email: { type: String, required: true },
avatar: String,
})
// 3. Create a Model.
const User = model<IUser>('User', userSchema)
const foo = await User.find()
foo.map((e) => e.id)