使用mongoose@5.5.11
此命令可从mongo cli运行:
> db.pokemons.distinct('type_1')
[
"grass",
"fire",
"water",
// ...
]
但是这个Mongoose命令:
Pokemon.distinct('type_1')
失败:
Cast to ObjectId failed for value \"types\" at path \"_id\" for model \"Pokemon\"
(不知道值“类型”的来源是...)
相关架构详细信息:
const schema = new Schema({
//...
type_1: String,
type_2: String,
//...
});