索引的数据库游标范围在多个属性上 [英] Indexed DB cursor ranges on multiple properties

查看:79
本文介绍了索引的数据库游标范围在多个属性上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在indexeddb对象库上有两个属性的复合索引,并希望根据这两个属性的范围来检索游标。

I have a composite index of two properties on an indexeddb objectstore and wish to retrieve a cursor based on the range of both of these properties.

这是一个示例对象在商店中:

Here's an example object in the store :

{species: 'Oak',xcoord: 123456, ycoord: 654321}

和索引:

treeStore.createIndex("treelocation", ["xcoord","ycoord"], { unique: false });

创建索引是成功的,我可以在Chrome开发者工具中看到它,但是现在我想喜欢在x和y坐标上打开一个带有键范围的光标(这将是地图的范围)。

The index creation is succesful and I can see it in the Chrome developer tools, however now I'd like to open a cursor with a keyrange on both the x and y co-ordinates (which will be the extent of a map).

在线搜索我看不到怎么做,打开带有一系列键范围的索引似乎不起作用。

Searching online I can't see how to do this, and opening an index with an array of key ranges doesn't seem to work.

推荐答案

我被告知解决方案确实是 IDBKeyRange.bound([lowX,lowY],[highX,highY])

I have been told the solution is indeed IDBKeyRange.bound([lowX,lowY],[highX,highY]).

这篇关于索引的数据库游标范围在多个属性上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆