获取错误未知的顶级运算符 $regex
搜索.vue `
let questDocuments = await conversation
.find({ query: { $limit: 100, $search: q, skippop: true } })
.then(response => {`
q 是被传递的字符串
服务 Hook
before: {
all: [],
find: [
hookBeforeFind,
search({
fields: ["label"],
deep: true
})
],
模型
const conversation = new Schema(
{
label: { type: String, required: true },
nodeId: { type: String, required: true },
details: { type: String },
url: { type: String },
creator: { type: String },
handle: { type: String },
date: { type: String },
从搜索栏添加表达式进行搜索。例如“那个”
最佳答案
将$regex 添加到whitelist option Mongoose 服务:
app.use('/messages', service({
Model,
whitelist: [ '$regex' ]
}));
关于vue.js - 从 vue 客户端使用 mongoose 进行模糊搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54676962/