For example, the collection test has the following document format
{
"_id" : ObjectId("123456"),
"name" : "test",
"body" : [
{
"hash" : "123123123"
}
]
}
At this time, if you want to create an index for the hash key, how should you create it? the value of body is an array, so it’s a bit confusing.
db.test.createIndex({"body.hash": 1})