-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add Query Functionality #26
Conversation
Added JSDoc comments and minor cleanup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two more notes in addition to the comments I left:
- If I set the
path
for a query to be a nested collection (like the"string/to/collection"
given in your example), I get this error back in the response:Error: Collection id "query_test/dummy/nested" is invalid because it contains "/".
I didn't look too much into the cause of it — does anything jump out to you? - What do you think of having the
getDocuments
function route through the query function instead of getting a list of documents from a GET request for a collection? It looks like that doesn't require dealing with the page token, which would be nice. I'm in favor of this option, so if you agree, could you update that? Then we could finally close Add method for getting list of documents (as objects) from a collection #5!
Other than these notes, this is great. Definitely the most thorough PR this library has seen yet! 🙌
} | ||
|
||
const query = { | ||
from: from.map(function (collection) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line confused me for a while since I was thinking from
was a string. It's an array, though, right? Could you update the class-level comment to say this parameter is an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from
gets transformed into an array. I guess I overlooked that JSDoc comment. Thanks!
Util.js
Outdated
@@ -12,6 +12,10 @@ function isInt_ (n) { | |||
return n % 1 === 0 | |||
} | |||
|
|||
function IsNumeric_ (val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you capitalized this function's name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy pasta oversight.
} | ||
|
||
function getObjectFromResponse_ (response) { | ||
return JSON.parse(response.getContentText()) | ||
function fetchObject_ (url, options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it gets even better in the other PR. :)
|
|
@LaughDonor Sounds good. I haven't gotten a chance to look at the other PR yet, but I'm looking forward to it! Once this PR has the I'm going to wait to pull this in, though, until that other PR has the fix (even though it's probably not a big deal to have code in |
The other PR will have that fix in for |
@LaughDonor Oh right, my bad! Missed that part. Okay, in it goes. 🚀 |
Matched the style of
wrapArray_()
tocreateFirestoreDocument_()
To use:
All chained methods between
query()
andexecute()
(not inclusive) are optional.Multiple paths can be searched. i.e.
db.query(path1, path2, path3, etc...)
The Wiki will also need to be updated if this gets merged in.