25
25
import com .google .firebase .firestore .model .DocumentKey ;
26
26
import com .google .firebase .firestore .model .MaybeDocument ;
27
27
import com .google .firebase .firestore .model .ResourcePath ;
28
+ import com .google .firebase .firestore .model .SnapshotVersion ;
28
29
import com .google .firebase .firestore .util .BackgroundQueue ;
29
30
import com .google .firebase .firestore .util .Executors ;
30
31
import com .google .protobuf .InvalidProtocolBufferException ;
@@ -142,6 +143,7 @@ public ImmutableSortedMap<DocumentKey, Document> getAllDocumentsMatchingQuery(
142
143
143
144
String prefixPath = EncodedPath .encode (prefix );
144
145
String prefixSuccessorPath = EncodedPath .prefixSuccessor (prefixPath );
146
+ Timestamp updateTime = sinceUpdateTime .getTimestamp ();
145
147
146
148
BackgroundQueue backgroundQueue = new BackgroundQueue ();
147
149
@@ -152,8 +154,14 @@ public ImmutableSortedMap<DocumentKey, Document> getAllDocumentsMatchingQuery(
152
154
int rowsProcessed =
153
155
db .query (
154
156
"SELECT path, contents FROM remote_documents WHERE path >= ? AND path < ? "
155
- + "AND (snapshot_version_micros > ? OR snapshot_version_micros IS NULL)" )
156
- .binding (prefixPath , prefixSuccessorPath , sinceUpdateTime .toMicroseconds ())
157
+ + "AND (update_time_seconds IS NULL OR update_time_seconds > ? "
158
+ + "OR (update_time_seconds = ? AND update_time_nanos > ?))" )
159
+ .binding (
160
+ prefixPath ,
161
+ prefixSuccessorPath ,
162
+ updateTime .getSeconds (),
163
+ updateTime .getSeconds (),
164
+ updateTime .getNanoseconds ())
157
165
.forEach (
158
166
row -> {
159
167
// TODO: Actually implement a single-collection query
0 commit comments