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

(daleharvey/pouchdb#1199) - query() supports keys (rebased on #9) #11

Closed
wants to merge 2 commits into from

Conversation

nolanlawson
Copy link
Member

The query() function now supports keys as an input param.
Keys are hashed in advance, to ensure that the complexity
is O(n) rather than O(n * m), where n is numDocs and m
is numKeys.

Since there are a lot of edge cases for null/undefined/etc.,
I'm also adding unit tests to daleharvey/pouchdb, which
confirm that the functionality is exactly like CouchDB's.

@nolanlawson
Copy link
Member Author

#9 is awesome by the way; thank you for setting it up so we can test both at the same time.

@calvinmetcalf
Copy link
Member

I am still getting the same 2 errors

@nolanlawson
Copy link
Member Author

Hm, that's super weird. TBH I never actually saw those two errors you mentioned in #8, and 1c78760 works fine for me. I do npm install ; npm run build ; npm test and get 42 passing tests.

What version of Node are you running? I'm on Node 0.10.12, but I will try 0.10.24 and 0.11.

In case it's not that, my other system details are: OS X Mountain Lion 10.8.5, CouchDB 1.5.0, LevelDB 1.14.0.

@nolanlawson
Copy link
Member Author

I can't get leveldown to build in Node 0.11.0, but 0.10.24 works fine.

@nolanlawson
Copy link
Member Author

Tried it on a fresh Linux installation and it works there as well (crunchbang, node 0.10.24). Your errors seem to pop up because emit(doc.foo, null) is failing when doc.foo is undefined, which is why I'm guessing it's a node issue.

Also, sorry for not being forthright before about not seeing your errors; I thought they were related to the key+docid sorting problem, but it looks like that's an orthogonal issue.

@calvinmetcalf
Copy link
Member

Oh, I think this is my fault , I bet I'm testing against version 1.0.0.
Will check when I get home, might be a good idea to change the dev
dependency to ~1.1.0
On Jan 4, 2014 1:53 PM, "Nolan Lawson" notifications@github.com wrote:

Tried it on a fresh Linux installation and it works there as well
(crunchbang, node 0.10.24). Your errors seem to pop up because emit(doc.foo,
null) is failing when doc.foo is undefined, which is why I'm guessing
it's a node issue.

Also, sorry for not being forthright before about not seeing your errors;
I thought they were related to the key+docid sorting problem, but it looks
like that's an orthogonal issue.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11#issuecomment-31585546
.

@calvinmetcalf
Copy link
Member

yeah it's testing against a really old version of pouch, which leaves us with only one error, which is related to the way errors changed in pouch this line should have the keys 'error' and 'reason' changed to 'name' and 'message'. if you change that, then change this line to err.name (along with switching the dev depencency of pouch to ~1.1.0 from 0.1.6 we should be all set

The query() function now supports keys as an input param.
Keys are hashed in advance, to ensure that the complexity
is O(n) rather than O(n * m), where n is numDocs and m
is numKeys.

Since there are a lot of edge cases for null/undefined/etc.,
I'm also adding unit tests to daleharvey/pouchdb, which
confirm that the functionality is exactly like CouchDB's.
@nolanlawson
Copy link
Member Author

OK, we should be good to go now. Also had to change these lines.

@calvinmetcalf
Copy link
Member

merged

@calvinmetcalf calvinmetcalf mentioned this pull request Jan 6, 2014
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

Successfully merging this pull request may close these issues.

None yet

2 participants