Closed anxuanzi closed 3 years ago
The name of the field is "StorageScope" not "admin.user". The Index
query method doesn't actually do a criteria check. It's a hint telling the query planner what index to use.
You probably want a query like this:
err := app.Store.FindOne(dbResult, badgerhold.Where("Username").Eq("abcd").And("StorageScope").Eq("admin.user").Index("StorageScope"))
Thank you so much! Now I understood what the index is for.
Hi, I was trying to use badgerhold in my project. I got a problem when I was trying to find a record. It said, "Nested indexes are not supported. Only top level structures can be indexed". I not so sure what I did wrong, or maybe I misunderstand the 'index' feature. If, I did anything wrong, please help me out to understand the index feature. Thank you!
Data struct:
Code for inserting data:
Code for finding record:
Error message:
panic: Nested indexes are not supported. Only top level structures can be indexed
Some additional information: