Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

fix(mongodb): nested ObjectId(...) / ISODate(...) in MQL reach the server as {$oid} / {$date} maps

Offen
#1,667 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
dart, flutter, mongodb
Bereich
database, databases

Rechercherichtung

Read lib/features/mongodb/mql_parser.dart to trace how nested Extended JSON wrappers become maps, then inspect mongo_ejson.dart for the existing conversion. Find where the query workspace passes parsed filters and documents, and add tests for nested ObjectId and ISODate values plus strings containing those expressions. Done means the nested values reach the query as BSON ObjectId and DateTime values while matching strings stay strings.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Problem

In the Mongo query workspace, ObjectId(...) and ISODate(...) nested inside a filter or document never become a BSON ObjectId or date:

db.users.find({ _id: ObjectId("5f1d7f0b9d3e2a0017a1b2c3") })
db.events.find({ at: { $gte: ISODate("2026-01-01") } })
db.users.insertOne({ owner: ObjectId("5f1d7f0b9d3e2a0017a1b2c3") })

MqlParser._normalizeJsObject (lib/features/mongodb/mql_parser.dart) turns them into Extended-JSON-shaped maps, {"$oid": "…"} and {"$date": "…"}, and json.decode keeps them as plain maps. Nothing on the MQL path converts them afterwards:

  • mongo_query_workspace.dart sends MqlCommand.filter / document as parsed;
  • mongo_ejson.dart / mongo_field_codec.dart, which do understand $oid, are used by the document views, not here.

So the server receives {_id: {$oid: "…"}}:

  • the find above matches nothing (or fails with an unknown-operator error, depending on the position);
  • an insert stores a sub-document { $oid: … } instead of an ObjectId.

Only a top-level argument that is itself ObjectId(...) / ISODate(...) is converted (MqlParser._parseRelaxedJson).

Noticed while fixing the normalizer in #1661 (#1513, #1539); not changed there.

Expected

After parsing, walk the filter / update / document / pipeline and convert Extended JSON wrappers into BSON values:

  • {"$oid": "<24 hex>"} → ObjectId;
  • {"$date": "<ISO>"} → DateTime (UTC);
  • optionally {"$numberLong": "…"}.

Reuse the conversion mongo_ejson.dart already has, so the document views and the query workspace agree.

Tests
  • find({ _id: ObjectId("…") }) gives a filter whose _id is an ObjectId;
  • an ISODate inside $gte is a DateTime;
  • insertOne with a nested ObjectId stores an ObjectId;
  • a string that merely contains ObjectId("…") stays a string.
Vorherrschende Sprache
Dart
Sterne
23
Forks
1
Ø Merge
31 Min.
Gemergte PRs (30 T.)
570

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus QueryaHub/Querya-Desktop

Alle Issues in QueryaHub/Querya-Desktop

Ähnliche Issues

Weitere Issues zu Dart

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.