Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Is this still required? #6

Open
CamiloMM opened this issue May 9, 2015 · 4 comments
Open

Is this still required? #6

CamiloMM opened this issue May 9, 2015 · 4 comments

Comments

@CamiloMM
Copy link

CamiloMM commented May 9, 2015

If I run the following:

var mySchema = new Schema({data: {}});
mySchema.index({'data.maybe': 1}, {sparse: true});

It runs without errors, so, did Mongoose folks fix the issue that prevented this from working?

(On a related note: is there an issue filled with them about this? It could be liked from the readme here.)

@CamiloMM
Copy link
Author

Moreover: if I connect to my db and run

db.mycollection.getIndexes()

I get an index such as:

[
    ...
    {
        "v" : 1,
        "key" : {
                "data.maybe" : 1
        },
        "name" : "data.maybe_1",
        "ns" : "mydb.mycollection",
        "sparse" : true,
        "background" : true,
        "safe" : null
    },
    ...
]

Doesn't that mean it's properly indexed?

@rgarcia
Copy link
Member

rgarcia commented May 11, 2015

@CamiloMM what version of mongoose did you run that with? The library here is tested on ~3.6.8.

@CamiloMM
Copy link
Author

@rgarcia 3.8.24, sorry for the delay.

@rgarcia
Copy link
Member

rgarcia commented May 19, 2015

@CamiloMM thanks. It's very likely that mongoose fixed this in 3.8. You could test this by upgrading package.json here to 3.8, changing the tests to use mongoose and not any_index (here and here), and then running the tests. If the tests pass, then mongoose fixed this in 3.8.

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

No branches or pull requests

2 participants