erikolson186 / zangodb

MongoDB-like interface for HTML5 IndexedDB
https://erikolson186.github.io/zangodb/
MIT License
1.07k stars 72 forks source link

Index all fields of array of objects #22

Open Garito opened 7 years ago

Garito commented 7 years ago

Hi! Giving this data:

{
  "_id": "12451234",
  "tracks": [
    {"creation": "2017-11-12", "text": "asfdasdfas"},
    {"creation": "2017-11-11", "text": "asdfadsfasd"},
  ]
}

is it possible to index tracks.creation? How?

Thanks

erikolson186 commented 7 years ago

Unfortunately that is not possible with IndexedDB as of now.

Garito commented 7 years ago

Feature request? Mongo does like this: https://docs.mongodb.com/manual/core/index-multikey/

erikolson186 commented 7 years ago

Yes, but IndexedDB does not support that feature.

Garito commented 7 years ago

Perhaps, but it can be done and would be convenient (mongodb supports it too): http://dexie.org/docs/Version/Version.stores()

erikolson186 commented 7 years ago

Dexie.js does not support it either. Indexes of attributes of objects within arrays cannot be created with IndexedDB. I agree that it would be convenient though.

Garito commented 7 years ago

I've checked again: the multi-entry index is for arrays not for keys in arrays, sorry

Thanks!