Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Lawnchair-IndexedDB doesn't support multiple records. #172

Open
paolooo opened this issue Jul 26, 2013 · 0 comments
Open

Lawnchair-IndexedDB doesn't support multiple records. #172

paolooo opened this issue Jul 26, 2013 · 0 comments

Comments

@paolooo
Copy link

paolooo commented Jul 26, 2013

Hi,

I tried creating multiple records in indexed-db but it won't allow me.
Nike and adidas objectStores

var nike = Lawnchair({adapter:'indexed-db', name:'stores', record:'nike'},function(e){
    console.log("nike store open");
    this.save({id:1}, function(data){
        console.log('nike data: ', data);
    });
});

var adidas = Lawnchair({adapter:'indexed-db', name:'stores', record:'adidas'},function(e){
    console.log("adidas store open");
    this.save({id:1}, function(data){
        console.log('adidas data: ', data);
    });
});

I think this is how to create multiple records in indexed-db. It will happen on request.onupgradeneeded.

// Handle datastore upgrades.
request.onupgradeneeded = function(e) {
    var db = e.target.result;

    var nike = db.createObjectStore('nike');
    var adidas = db.createObjectStore('adidas');
};

If I can't create an adidas record this is actually the error that is thrown:
[Exception... "The operation failed because the requested database object could not be found. For example, an object store did not exist but was being opened." code: "8" ...]

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

No branches or pull requests

1 participant