Skip to content

Commit 6679484

Browse files
committed
fix(ht_data_mongodb): improve cursor retrieval
- Use `findOne` with direct `_id` query - Remove unnecessary `where.id` call - Improve error handling and logging - Reduce code complexity - Minor code cleanup
1 parent abec4d1 commit 6679484

File tree

2 files changed

+63
-64
lines changed

2 files changed

+63
-64
lines changed

coverage/lcov.info

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ DA:118,1
3838
DA:123,1
3939
DA:124,3
4040
DA:127,1
41-
DA:129,4
41+
DA:129,3
4242
DA:131,3
4343
DA:135,1
4444
DA:136,2
@@ -119,83 +119,82 @@ DA:292,1
119119
DA:293,1
120120
DA:295,1
121121
DA:296,2
122-
DA:300,2
123-
DA:303,2
124-
DA:304,3
125-
DA:306,2
126-
DA:308,3
122+
DA:300,1
123+
DA:301,1
124+
DA:304,1
125+
DA:306,1
126+
DA:308,2
127127
DA:310,2
128-
DA:312,2
129-
DA:314,3
130-
DA:317,1
131-
DA:318,3
132-
DA:321,1
128+
DA:312,3
129+
DA:315,1
130+
DA:316,3
131+
DA:319,1
132+
DA:325,1
133133
DA:327,1
134+
DA:328,2
134135
DA:329,1
135-
DA:330,2
136-
DA:331,1
136+
DA:332,1
137137
DA:334,1
138-
DA:336,1
139-
DA:337,2
140-
DA:338,2
141-
DA:342,1
142-
DA:348,2
143-
DA:349,2
144-
DA:352,1
145-
DA:353,2
146-
DA:356,1
147-
DA:357,1
148-
DA:360,1
138+
DA:335,2
139+
DA:336,2
140+
DA:340,1
141+
DA:346,2
142+
DA:347,2
143+
DA:350,1
144+
DA:351,2
145+
DA:354,1
146+
DA:355,1
147+
DA:358,1
148+
DA:361,1
149149
DA:363,1
150-
DA:365,1
150+
DA:366,2
151151
DA:368,2
152-
DA:370,2
153-
DA:371,3
154-
DA:372,1
155-
DA:375,1
156-
DA:376,2
152+
DA:369,3
153+
DA:370,1
154+
DA:373,1
155+
DA:374,2
156+
DA:379,1
157157
DA:381,1
158+
DA:382,2
158159
DA:383,1
159-
DA:384,2
160-
DA:385,1
160+
DA:386,1
161161
DA:388,1
162-
DA:390,1
163-
DA:391,2
164-
DA:392,2
165-
DA:396,1
166-
DA:401,2
167-
DA:402,2
168-
DA:405,1
169-
DA:406,2
162+
DA:389,2
163+
DA:390,2
164+
DA:394,1
165+
DA:399,2
166+
DA:400,2
167+
DA:403,1
168+
DA:404,2
169+
DA:406,1
170170
DA:408,1
171+
DA:409,2
171172
DA:410,1
172-
DA:411,2
173-
DA:412,1
174-
DA:415,1
175-
DA:416,2
176-
DA:417,2
177-
DA:421,1
178-
DA:426,2
179-
DA:427,2
180-
DA:431,1
181-
DA:437,2
182-
DA:438,1
173+
DA:413,1
174+
DA:414,2
175+
DA:415,2
176+
DA:419,1
177+
DA:424,2
178+
DA:425,2
179+
DA:429,1
180+
DA:435,2
181+
DA:436,1
182+
DA:440,1
183+
DA:441,1
183184
DA:442,1
184-
DA:443,1
185185
DA:444,1
186186
DA:446,1
187+
DA:447,2
187188
DA:448,1
188-
DA:449,2
189-
DA:450,1
190-
DA:457,1
189+
DA:455,1
190+
DA:456,2
191191
DA:458,2
192-
DA:460,2
193-
DA:461,1
194-
DA:463,2
192+
DA:459,1
193+
DA:461,2
194+
DA:464,2
195+
DA:465,1
195196
DA:466,2
196-
DA:467,1
197-
DA:468,2
198-
DA:469,2
199-
LF:184
200-
LH:184
197+
DA:467,2
198+
LF:183
199+
LH:183
201200
end_of_record

lib/src/ht_data_mongodb.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class HtDataMongodb<T> implements HtDataClient<T> {
126126
}
127127
final cursorObjectId = ObjectId.fromHexString(cursorId);
128128

129-
final cursorDoc = await _collection.findOne(where.id(cursorObjectId));
129+
final cursorDoc = await _collection.findOne({'_id': cursorObjectId});
130130
if (cursorDoc == null) {
131131
_logger.warning('Cursor document with id $cursorId not found.');
132132
throw const BadRequestException('Cursor document not found.');

0 commit comments

Comments
 (0)