我可以为这个表创建一个二级索引:
{
contact: [
'example@example.com'
]
}像这样:indexCreate('contact', {multi: true})
但是我可以为这个创建索引吗:
{
contact: [
{
type: 'email',
main: true
value: 'andros705@gmail.com'
}
{
type: 'phone'
value: '0735521632'
}
]
}辅助索引将只在类型为'email‘且main设置为'true’的对象中搜索
发布于 2017-07-14 23:15:49
下面是创建这样一个索引的方法:
table.indexCreate(
'email',
row => row('contact').filter({type: 'email'})('value'),
{multi: true})这是通过使用多索引来实现的。当multi: true参数传递给indexCreate时,index函数应该返回一个数组而不是单个值。该数组中的每个元素都可用于在索引中查找文档(使用getAll或between)。如果数组为空,则文档不会显示在索引中。
https://stackoverflow.com/questions/45091268
复制相似问题