Hello, I would like to retrieve a list of keys that start with the word ‘level’ using the .query
method of the storage API, and I encountered the following error:
ERROR 2023-08-08T01:39:05.963Z 9e446514-f7e8-41da-acda-cfb0dd195449 resolvedData.map is not a function
TypeError: resolvedData.map is not a function
at getData (index.js:39779:39)
at async index.js:33785:21
at async asyncMap (index.js:33716:24)
at async index.js:33737:29
at async index.js:33262:31
Here is my code:
const getData = async () => {
const {resolvedData} = await storage.query()
.where('key',startsWith('level'))
.limit(20)
.getMany();
const dataPromises = resolvedData.map((r) => r.value);
for( let l of dataPromises){
dataPromises.push(storage.get(l));
}
const data = await Promise.all(dataPromises);
return data;
};