[Docs] Prisma ORM 8 / MongoDB: Decimal128 lacks usage guidance (input format, update operators, pipeline results)

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

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

@amrsorne がすでに取り組んでいます。

2026年11月18日 から。

  • #8868 @amrsorne による — オープン

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
ドキュメント
明瞭さ
おおむね明確
活発さ
活発
技術スタック
mongodb

調査の方向性

Start with the Field types table and the Json note on the MongoDB data-modeling docs page, which is where the new Decimal128 subsection would go. Several answers (number handling, malformed input, inc() and mul() on Decimal128, pipeline result types) must be checked by running the ORM against a test MongoDB, not read from the docs. Done means a Decimal128 subsection with a verified contract and examples, and unsupported behaviour explicitly noted.

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

説明

Page

https://www.prisma.io/docs/orm/data-modeling/mongodb

What the page says today

The Field types table lists Decimal128 as stored as BSON decimal and exposed in code as "a string, so that no digit is lost". The note under the table says a Decimal128 value inside a Json field fails with RUNTIME.DECODE_FAILED / RUNTIME.ENCODE_FAILED.

That is all the page says about it. There is no contract example that declares a Decimal128 field, and no example of writing, filtering, or updating one through db.orm.

Questions the docs don't answer
  1. Write input. Do create() and update() accept only decimal text such as "129.99"? Is a JS number rejected with RUNTIME.ENCODE_FAILED, or converted? Is a Decimal128 instance from the mongodb package accepted?
  2. Invalid input. What happens with malformed text such as "12.3.4", or with a value that has more than 34 significant digits?
  3. Update operators. The ORM client reference says inc() and mul() are offered on numeric fields only. Does that include Decimal128? If so, what does inc() take? A number would lose precision before the value reaches the database; if it takes decimal text, that should be documented.
  4. Pipeline builder results. The pipeline builder reference says documents come back raw once a stage such as group() is present. Does that mean acc.sum(f.price) over a Decimal128 field returns a mongodb Decimal128 object instead of the decimal text the ORM returns? What is the TypeScript type of that result?
  5. Pipeline builder filters. match() does not convert values. To compare a Decimal128 field in match(), should we pass Decimal128.fromString(...) directly, or wrap it in MongoParamRef? The 8.0.0-rc.14 release notes say query-builder filters comparing with a Decimal128 now match the stored value, but the docs don't show the call.
Suggested change

A short Decimal128 subsection under Field types with:

  • a contract example
  • create, where (with MongoFieldFilter.gte), and update examples showing the accepted input
  • a note on update operators and on pipeline-builder results and filters
  • a recommendation to use a decimal library instead of Number(...) for arithmetic
Minimal contract
model Product {
  id    ObjectId   @id @map("_id")
  name  String
  price Decimal128
  @@map("products")
}
Environment
  • prisma:
  • @prisma/orm-mongo:
  • MongoDB server:
  • Node.js:
Additional context

MongoDB support in Prisma ORM 8 is early access, so some of this may be intentionally undocumented. If so, a short note saying which of these are not supported yet would already help.

主要言語
MDX
スター
1.1k
フォーク
1k
平均マージ
15時間 23分
マージ済み PR(30日)
298

環境構築

はじめの一歩

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

prisma/web のほかの issue

prisma/web の issue をすべて見る

似ている issue

Databases の issue をもっと見る

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

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