【发布时间】:2022-02-20 06:34:13
【问题描述】:
我有两个猫鼬模型,它们的关系如下:
const ProductSchema: Schema = new Schema(
{
name: String,
category: {
type: Schema.Types.ObjectId,
ref: 'Category'
},
description: String
}
在name 和description 字段上有一个文本索引。
类别架构如下所示
const CategorySchema: Schema = new Schema(
{
title: String
}
在title 字段上有文本索引。
是否可以对产品进行全文搜索,例如关键字可以包含类别标题,甚至可以仅使用类别标题进行文本搜索?
【问题讨论】: