[Docs] Prisma ORM 8 / MongoDB: Decimal128 lacks usage guidance (input format, update operators, pipeline results)
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- mongodb
- Lĩnh vực
- databases, documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Write input. Do
create()andupdate()accept only decimal text such as"129.99"? Is a JSnumberrejected withRUNTIME.ENCODE_FAILED, or converted? Is aDecimal128instance from themongodbpackage accepted? - Invalid input. What happens with malformed text such as
"12.3.4", or with a value that has more than 34 significant digits? - Update operators. The ORM client reference says
inc()andmul()are offered on numeric fields only. Does that includeDecimal128? If so, what doesinc()take? Anumberwould lose precision before the value reaches the database; if it takes decimal text, that should be documented. - Pipeline builder results. The pipeline builder reference says documents come back raw once a stage such as
group()is present. Does that meanacc.sum(f.price)over aDecimal128field returns amongodbDecimal128object instead of the decimal text the ORM returns? What is the TypeScript type of that result? - Pipeline builder filters.
match()does not convert values. To compare aDecimal128field inmatch(), should we passDecimal128.fromString(...)directly, or wrap it inMongoParamRef? The 8.0.0-rc.14 release notes say query-builder filters comparing with aDecimal128now 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(withMongoFieldFilter.gte), andupdateexamples 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.
- Ngôn ngữ chính
- MDX
- Star
- 1.1k
- Fork
- 1k
- Merge trung bình
- 15 giờ 23 phút
- Pull request đã merge (30 ngày)
- 298
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của prisma/web
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Extension submission: ltreeĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Extension submission: prisma-sqlĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
prisma/web#8747 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New Prisma site header lags when transitioning to pillCó thể đã có người làm @akshy-rai đã nhận 56 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
area:breg enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
registrystack/registry-stack#2765 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug platform-macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
TableProApp/TablePro#4389 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
nowledge-co/hawdb#1881 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
autofixer: follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
tursodatabase/turso#12217 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Aggregate ignores order by expressions that contain spacesCó thể đã có người làm @chuenchen309 đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày