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

calling ensureIndex() before load() will break find() queries functionality #27

Closed
aabluedragon opened this issue Feb 15, 2015 · 4 comments

Comments

@aabluedragon
Copy link

Reproduction steps:

call myCollection.ensureIndex({id:1}) before calling load().
after, try (inside load callback function):

myCollection.find({
   id:"1"
});

Use the same property you used for indexing in your find() query, in this case i used 'id',
it will return an empty array.

As a temporary solution, I surrounded all my ensureIndex() calls inside the load() callback of each collection, like so:

    item.load(function(err){
        item.ensureIndex({
            id: 1
        });
    });
@Irrelon
Copy link
Owner

Irrelon commented Feb 15, 2015

Thanks for the bug report. We'll add it to the list of fixes for this version. 👍

@Irrelon
Copy link
Owner

Irrelon commented Feb 20, 2015

Any chance you could check if this was resolved by the 1.3.1 update as well? I think it has been...

@aabluedragon
Copy link
Author

Checked, sorry, not fixed

Irrelon added a commit that referenced this issue Feb 24, 2015
Irrelon added a commit that referenced this issue Feb 24, 2015
@Irrelon
Copy link
Owner

Irrelon commented Feb 24, 2015

All fixed in version 1.3.3

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

No branches or pull requests

2 participants