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

Filtered subcollections expose parent collection items #177

Open
ahamid opened this issue Mar 13, 2016 · 0 comments
Open

Filtered subcollections expose parent collection items #177

ahamid opened this issue Mar 13, 2016 · 0 comments

Comments

@ahamid
Copy link

ahamid commented Mar 13, 2016

It appears that (at least for Memory store) filtering produces sub-collections that expose (excluded) parent items. Memory.getSync explicitly retrieves items from storage.fullData, so I wonder if this is by design for some reason:

getSync: function (id) {
    return this.storage.fullData[this.storage.index[id]];
},
var all = new Memory({data:[{id:1, c: 'all'}, {id:2, c: 'subset'}]})
var subset = all.filter({c: 'subset'})
subset.fetchSync() // [{id:2, c: 'subset'}]
subset.data        // [{id:2, c: 'subset'}]
subset.get(1)      // {id:1, c: 'all'}, I would expect null/undefined here

Hypothetically Memory could consult data instead of this.storage.fullData however it appears that lookup is based on an position index maintained against the fullData, so doing so would require keeping a per-sub-collection index for lookups (or changing how indexing/lookup is implemented).

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

No branches or pull requests

1 participant