普通网友 2020-12-09 17:29 采纳率: 0%
浏览 16

巨杉数据库SequoiaDB中子文档创建复合索引失败

在如下的集合中:
product
{
id:'',
name:'',
model:[
{id,type:1,name:'1',...},{id,type:2,name:'2',...}...
],
...
},...
假设我们要查询所有包含{type:1,name:'1'}的产品记录,为了加快速度,创建如下索引
product.createIndex('idx_product_model',{'model.type':1,'model.name':1});

失败:
(shell):1 uncaught exception: -37
More than one fields are array type
Takes 0.001910s.

请问一下,这个为什么会报错?这个是一个数组【model】上的多个字段组合索引,没有涉及到多个数组啊。

那如果要实现在子文档上创建复合索引,该怎么建立?

期待回复

  • 写回答

1条回答 默认 最新

  • 云域A 新星创作者: 操作系统、云计算技术领域 2023-01-19 21:27
    关注

    失败:
    (shell):1 uncaught exception: -37
    More than one fields are array type
    Takes 0.001910s.

    评论

报告相同问题?