louischatriot / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser
MIT License
13.49k stars 1.03k forks source link

Is it possible to make indexing for group fields? #460

Open alexustinovsm opened 8 years ago

alexustinovsm commented 8 years ago

For instance, I want to build an index for group fields like this

db.ensureIndex({ fieldNames: ['somefield1', 'somefield2'] }, function (err) {
  // If there was an error, err is not null
});
louischatriot commented 8 years ago

Compound indexes are not yet possible and I'm not planning on adding them. You can easily mimic that behavior though, by creaating a third field that concatenates the first two and index that.

2016-10-06 17:18 GMT+02:00 Alexander Ustinov notifications@github.com:

For instance, I want to build an index for group fields like this

db.ensureIndex({ fieldNames: ['somefield1', 'somefield2'] }, function (err) { // If there was an error, err is not null });

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/louischatriot/nedb/issues/460, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4ikwgLRMzeYPhE1cPFq7qtjGywQq5aks5qxRFVgaJpZM4KQEZv .

Rajas-Git commented 7 years ago

If compound indexing is not possible, why was #93 closed with commits?

bdfoster commented 7 years ago

93 was closed, not merged.

On Apr 5, 2017 6:50 PM, "Rajas-Git" notifications@github.com wrote:

If compound indexing is not possible, why was #93 https://github.com/louischatriot/nedb/issues/93 closed with commits?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/louischatriot/nedb/issues/460#issuecomment-292019727, or mute the thread https://github.com/notifications/unsubscribe-auth/ACA19kd3lfJUl5twVzp3wiZc28J3xw-Dks5rtBrIgaJpZM4KQEZv .