Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#1,667 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
dart, flutter, mongodb

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
Dart
スター
23
フォーク
1
平均マージ
31分
マージ済み PR(30日)
570

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QueryaHub/Querya-Desktop のほかの issue

QueryaHub/Querya-Desktop の issue をすべて見る

似ている issue

Dart の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。