Can indexedDB query with multiple conditions?

{id:1,name:"",age:24,email:"qweqwe@qwe.com"}
{id:2,name:"",age:17,email:"qweqwe@qwe.com"}
{id:3,name:"",age:27,email:"qweqwe@qwe.com"}
{id:4,name:"",age:17,email:"qweqwe@qwe.com"}
{id:5,name:"",age:16,email:"qweqwe@qwe.com"}

how can I find out the data of name=" King "and age=17?

Index and cursor can only look up all name=" King"or all age=17 data. Can only find out a set, and then write the judgment condition Filter?


you need to index the field names to be queried first, and then use IDBKeyRange.only () to filter


objectStore.createIndex ('name_age', [' name','age'], {unique: false}); two fields are passed in when indexing

openCursor (IDBKeyRange.only (['Wang', 17]) is queried with an array

Menu