Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

as fou multiple conditions #48

Open
cjz9032 opened this issue Oct 14, 2015 · 2 comments
Open

as fou multiple conditions #48

cjz9032 opened this issue Oct 14, 2015 · 2 comments

Comments

@cjz9032
Copy link

cjz9032 commented Oct 14, 2015

    $indexedDBProvider
    .connection('myIndexedDB11')
    .upgradeDatabase(1, function(event, db, tx) {
        var objStore = db.createObjectStore('5173', {
            keyPath: "id",
            autoIncrement: true
        });
        objStore.createIndex('i3n_idx', ['hero','skin','price'], {
            unique: false
        });
    });

$indexedDB.openStore('5173', function(store) {
        var find = store.query();
        //  $between(lower, upper, doNotIncludeLowerBound? true/false, doNotIncludeUpperBound true/false) - between two bounds 
        find.$between(
            [$scope.vm.Hmin, $scope.vm.Smin, $scope.vm.Pmin], [$scope.vm.Hmax, $scope.vm.Smax, $scope.vm.Pmax], true, true
        );
        find.$index("i3n_idx");
        store.eachWhere(find).then(function(accounts) {
            $scope.vm.result = accounts; 
        });
    });

It looks like it just looking at the first condition( Hmin,Hmax ), ignoring the other conditions [(Smin,Smax)...].

@bramski
Copy link
Owner

bramski commented Oct 14, 2015

Sorry, it was a little unclear to me at first read. Looks like you have a compound index. $between is a really thin wrapper on the indexed-db API, so the problem you're dealing with is with the indexed db api. I haven't tried to iterate on multi value indices, so let me know if angular indexed db needs some additional support to allow you to do this.

@cjz9032
Copy link
Author

cjz9032 commented Oct 14, 2015

compound index here~ https://jsbin.com/ruzaju/8/edit?html,console,output
:) I should apologize for my crude code
0l9 yz hgbvc4anu_ jc

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants