Skip to content

Commit

Permalink
Adding DocumentSnapshot support for Cursors (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian committed Jan 12, 2018
1 parent 65d904a commit 563f8d0
Show file tree
Hide file tree
Showing 6 changed files with 561 additions and 67 deletions.
19 changes: 14 additions & 5 deletions src/path.js
Expand Up @@ -394,11 +394,20 @@ class ResourcePath extends Path {
* @returns {number} -1 if current < other, 1 if current > other, 0 if equal
*/
compareTo(other) {
if (this._projectId < other._projectId) {
return -1;
}
if (this._projectId > other._projectId) {
return 1;
// Ignore DocumentReference with {{projectId}} placeholders and assume that
// the resolved IDs match the provided ResourcePath. We could alternatively
// try to resolve the Project ID here, but this is asynchronous as it
// requires Disk I/O.
if (
this._projectId !== '{{projectId}}' &&
other._projectId !== '{{projectId}}'
) {
if (this._projectId < other._projectId) {
return -1;
}
if (this._projectId > other._projectId) {
return 1;
}
}

if (this._databaseId < other._databaseId) {
Expand Down

0 comments on commit 563f8d0

Please sign in to comment.