Compare commits

...

3 Commits

Author SHA1 Message Date
KillianG 007ff4bed3
Refactor readStream.js to use projection in find
query.
2023-11-13 10:25:43 +01:00
KillianG 5fe00985b2
Add console logs for query and doc in
MongoReadStream
2023-11-10 20:49:54 +01:00
KillianG c6751e674b
Exclude location field from search query in
MongoReadStream.
2023-11-10 19:23:42 +01:00
1 changed files with 4 additions and 1 deletions

View File

@ -85,9 +85,11 @@ class MongoReadStream extends Readable {
Object.assign(query, searchOptions); Object.assign(query, searchOptions);
} }
this._cursor = c.find(query).sort({ const projection = { 'value.location': 0 };
this._cursor = c.find(query, { projection }).sort({
_id: options.reverse ? -1 : 1, _id: options.reverse ? -1 : 1,
}); });
console.log(query);
if (options.limit && options.limit !== -1) { if (options.limit && options.limit !== -1) {
this._cursor = this._cursor.limit(options.limit); this._cursor = this._cursor.limit(options.limit);
} }
@ -105,6 +107,7 @@ class MongoReadStream extends Readable {
if (this._destroyed) { if (this._destroyed) {
return; return;
} }
console.log(doc);
let key = undefined; let key = undefined;
let value = undefined; let value = undefined;