所以,我在 github 上打开了问题:https ://github.com/SoftwareBrothers/adminjs/issues/883 。我该如何解决这个问题?对于模型_id,我使用 Number 而不是 ObjectId。
const slugify = require('slugify')
const autoIncrement = require('mongoose-auto-increment');
const countrySchema = new mongoose.Schema({
_id: Number,
title: {
type: String,
required: true
},
url: String
}, {
timestamps: true,
versionKey: false
})
countrySchema.plugin(autoIncrement.plugin, {
model: 'Country',
startAt: 1
})
mongoose.model("Country", countrySchema) ```
But AdminBro can't create relations (check my issue for info)
Please help)