以下是我的数据
{
"VehicleTrip": {
"departureTime": 1483176300000
},
"Orders": {
"Order": [{
"numberOfShops": 3,
"customerTitle": "Mrs",
"notes": ""
"orderId": "3060_1"
}, {
"numberOfShops": 3,
"customerTitle": "Mrs",
"notes": ""
"orderId": "3060_2"
}]
}
}
我想为orderId创建索引。我的桶名称是Delivery
我试过
CREATE INDEX isched1
ON `Delivery` (DISTINCT ARRAY v.orderId FOR v IN `Orders`.`Order` END);
但没用。 任何人都可以帮助我获取上述数据的索引。
谢谢, 维奈
答案 0 :(得分:0)
您的示例文档的Orders
对象与VehicleTrip
处于同一级别,而您的索引则视为VehicleTrip
的属性。
如果您打算嵌套,您的文档应如下所示
{
"VehicleTrip": {
"departureTime": 1483176300000
},
"Orders": {
"Order": [
{
"numberOfShops": 3,
"customerTitle": "Mrs",
"notes": "",
"orderId": "3060_1"
}, {
"numberOfShops": 3,
"customerTitle": "Mrs",
"notes": "",
"orderId": "3060_2"
}]
}
}
否则,您需要更新索引以匹配文档中的内容:
CREATE INDEX isched1
ON `Delivery` (DISTINCT ARRAY v.orderId FOR v IN `Orders`.`Order` END);