seald / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
351 stars 32 forks source link

Compound Indexes #26

Closed rmanibus closed 1 year ago

rmanibus commented 1 year ago

Is your feature request related to a problem? Please describe. Today it is only possible to create an index on one single field, but it is often required to index on multiple fields.

Describe the solution you'd like

I implemented compound indexes a while ago on my own nedb fork. (https://github.com/rmanibus/nedb/pull/1)

this is how it works:

db.ensureIndex({ fieldName: ["field1", "field2"] }, function (err) {});

my branch would need to be rebased but I think this can easily be integrated in that project.

rmanibus commented 1 year ago

I also have a github workflow ready for this project to execute tests on PR if you want

tex0l commented 1 year ago

This has been released in v4.0.0.