{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4841","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4841/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4841/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4841/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4841","id":129101456,"number":4841,"title":"Running viewCleanup directly after multiple databases are created fails","user":{"login":"juhasuni","id":2082878,"avatar_url":"https://avatars.githubusercontent.com/u/2082878?v=3","gravatar_id":"","url":"https://api.github.com/users/juhasuni","html_url":"https://github.com/juhasuni","followers_url":"https://api.github.com/users/juhasuni/followers","following_url":"https://api.github.com/users/juhasuni/following{/other_user}","gists_url":"https://api.github.com/users/juhasuni/gists{/gist_id}","starred_url":"https://api.github.com/users/juhasuni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juhasuni/subscriptions","organizations_url":"https://api.github.com/users/juhasuni/orgs","repos_url":"https://api.github.com/users/juhasuni/repos","events_url":"https://api.github.com/users/juhasuni/events{/privacy}","received_events_url":"https://api.github.com/users/juhasuni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-27T10:36:16Z","updated_at":"2016-01-27T10:39:50Z","closed_at":null,"body":"Simple test to reproduce the issue:\r\n```javascript\r\nvar barDb = new PouchDB('bar');\r\nvar fooDb = new PouchDB('foo');\r\nfooDb.viewCleanup();\r\n```\r\n\r\nThis fails with error `db.type is not a function` on Chrome. It looks like some adapter-specific part of database API is not completely initialized.\r\n\r\nTested with PouchDB `5.2.0` and both `Chrome`and `Universal Windows Platform / Windows 10`. This issue does not seem to be present in earlier versions of PouchDB.\r\n\r\nTo overcome this issue, you must listen to `created` event for all created databases and perform additional operations only after that. I think that this problem is not related to just `viewCleanup` but other operations may fail as well."},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/175544812","html_url":"https://github.com/pouchdb/pouchdb/issues/4841#issuecomment-175544812","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4841","id":175544812,"user":{"login":"nickcolley","id":2445413,"avatar_url":"https://avatars.githubusercontent.com/u/2445413?v=3","gravatar_id":"","url":"https://api.github.com/users/nickcolley","html_url":"https://github.com/nickcolley","followers_url":"https://api.github.com/users/nickcolley/followers","following_url":"https://api.github.com/users/nickcolley/following{/other_user}","gists_url":"https://api.github.com/users/nickcolley/gists{/gist_id}","starred_url":"https://api.github.com/users/nickcolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickcolley/subscriptions","organizations_url":"https://api.github.com/users/nickcolley/orgs","repos_url":"https://api.github.com/users/nickcolley/repos","events_url":"https://api.github.com/users/nickcolley/events{/privacy}","received_events_url":"https://api.github.com/users/nickcolley/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T10:39:50Z","updated_at":"2016-01-27T10:39:50Z","body":"Hey @juhasuni \r\n\r\nLooks like this problem might be fixed once this lands: https://github.com/pouchdb/pouchdb/pull/4804\r\n\r\nCould you try using the master branch of PouchDB and see if you can reproduce this issue?"}}