2

Generating a virtual column is the recommended way to index a JSON property.

But what if the property I want to index is inside an array or object? For example, if the JSON property is an array of userIds, and I'm querying for the userId in the array so I'd want to be indexed. What would be the best approach?

4
  • What is the query that you want to use an index? How does your schema look like? Commented Sep 11, 2016 at 15:16
  • Is this what you want to know? { "logs": [ {"userid":"1", "msg":"inserted"}, {"userid":"2", "msg":"updated"}, {"userid":"3", "msg":"updated"}, {"userid":"4", "msg":"deleted"} ] } Possible to index logs.userid ? Commented Jun 26, 2018 at 11:48
  • @JayDubal Exactly. Commented Jun 27, 2018 at 6:37
  • Please see the last answer from stackoverflow.com/questions/35198140/… Commented Jun 27, 2018 at 9:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.