1、新建云服务空间,新建测试表,表中插入带数组字段的数据如:{"a": ["1234"]};
2、jql查询条件where: '1234' == a;
lmc
- 发布:2025-04-29 11:03
- 更新:2026-01-08 10:13
- 阅读:454
最佳回复
数据字段为array数组,并且加了array 类型的索引,但是jql还是查询不到数据
hbuilderx版本4.87(ARM)
jql调试语句如下
db.collection('test').where({
"arr.name": "item-1"
}).get()
test.schema.json 文件如下
{
"bsonType": "object",
"required": [],
"permission": {
"read": true,
"create": true,
"update": true,
"delete": true
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"arr":{
"bsonType":"array"
}
}
}
test.index.json 文件如下
[{
"IndexName": "idx_arr",
"MgoKeySchema": {
"MgoIndexKeys": [{
"Name": "arr",
"Direction": "1",
"Type": "array"
}],
"MgoIsUnique": false
}
}]
test.init_data.json 文件如下
[{
"arr": [
{
"name": "item-1"
},
{
"name": "item-2"
}
]
},{
"arr": [
{
"name": "item-3"
},
{
"name": "item-4"
}
]
}
]

lmc (作者)
谢谢,我试试
2025-04-29 11:09