当函数 schema.index({ "name" : "text" }) 时未创建猫鼬索引;使用



输入图片描述

输入图片描述

模式。索引({"$**";text"}(;模式。索引({"名称";文本";});

可以使用

const mongoose = require("mongoose");
const adminSchema = mongoose.Schema(
{
name: { type: String, unique:true }// you can create index here also
}

最新更新