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

Implement query() and adding/removing indexes #3

Open
nolanlawson opened this issue Sep 11, 2014 · 6 comments
Open

Implement query() and adding/removing indexes #3

nolanlawson opened this issue Sep 11, 2014 · 6 comments

Comments

@nolanlawson
Copy link
Member

This is another Ember Data thing that we don't support yet. (query(), anyway).

@nolanlawson
Copy link
Member Author

I'd like to explicitly expose some methods like:

db.rel.createIndex('foo', {field: 'foo'})
db.rel.deleteIndex('foo', {field: 'foo'})
db.rel.query({field: 'foo', value: 'bar'})

Or something like that.

@oliviertassinari
Copy link

👍 It would be great.
I had to expose fromRawDoc() on the public API to make a query.

@nolanlawson
Copy link
Member Author

Actually nowadays it may make more sense to just directly plug into pouchdb-find and expose that in ember-pouch. However, I don't have much time for that project these days.

@vicpon
Copy link

vicpon commented May 28, 2015

I tried using pouchdb-find along side this plugin but since this one uses a "smart" ID for the document, pouchdb-find has trouble retrieving docs. I could have added the deserialize logic from this plugin but it turned out to be easier to work with the code without using both, so I just stuck with find.

@nolanlawson
Copy link
Member Author

@wujitouch Yeah, I think pouchdb-find integration needs to be implemented within this plugin itself.

@jlami
Copy link
Collaborator

jlami commented Nov 7, 2016

I added parseRelDocs in my PR #61 which I needed for my own find query. Thought it might be a good idea to expose this to the outside.

One extra problem i realised when looking at the filters was that db.find in pouchdb-find does not filter on types. So filtering on an attribute date might give more than one type back. But most of the time you only want one type back. For the findHasMany query I do this with an extra selector for the id.

So maybe it is better to make our own version of the query and index functions, since we might also want to include the id between filter to select only documents of a certain type.

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

4 participants