索引数据库中的两个索引列在Firefox中不工作

索引数据库中的两个索引列在Firefox中不工作,firefox,indexeddb,Firefox,Indexeddb,我正在为我的应用程序使用索引数据库 我有一个表产品,其中添加了两个索引 var product = evt.currentTarget.result.createObjectStore("product", { keyPath: product_id" }); product.createIndex("productIndex", "product_id", { unique: true }); product.createIndex("barCodeIndex", "ean_produc

我正在为我的应用程序使用索引数据库

我有一个表产品,其中添加了两个索引

 var product = evt.currentTarget.result.createObjectStore("product", { keyPath: product_id" });
 product.createIndex("productIndex", "product_id", { unique: true });
 product.createIndex("barCodeIndex", "ean_product", { unique: false });
在我的代码中,首先我在搜索产品id,如果结果为空,则为空 搜索条形码。问题是我写的代码正在工作 在Chrome和IE 10中表现良好,但在FF中不起作用。请建议

在我搜索条形码的其他部分,行 “var keyBarcode=barcodeSearch.index(“barCodeIndex”);”引发异常 操作失败,因为找不到请求的数据库对象。例如,对象存储不存在,但正在打开


我自己解决了这个问题

外壳有问题。在表上创建的索引是“BarCodeIndex”,我试图使用“BarCodeIndex”


你能发布可运行代码吗?
   var searchKey = IDBKeyRange.only(productId);
    var productSearch = localDatabase.db.transaction("product").objectStore("product");
    var key = productSearch.index("productIndex");
  key.get(searchKey).onsuccess = function (evt) {
        var productSearchResult = evt.target.result;
        if (productSearchResult != null) {
         //some logic

        } else {
            //search on bar code
            var barcode = $("#txtProductCode").val().trim();
            var barcodeKey = IDBKeyRange.only(barcode);
            var barcodeSearch = localDatabase.db.transaction("product").objectStore("product");

                var keyBarcode = barcodeSearch.index("barCodeIndex");
                keyBarcode.get(barcodeKey).onsuccess = function(event) {
                    var barcodeSearchResult = event.target.result;

                    if (barcodeSearchResult != null) {
                        //some logic                     
                    } 

                };

        }

    };
Point to be noted : Index names are case sensitive