使用自动化bigint ID的REST API阅读问题

发布于 2025-01-18 11:39:15 字数 548 浏览 4 评论 0原文

当我尝试从数据库中阅读时,我的REST API有一些问题。 现在,我的服务器堆栈是Nestjs + Prisma + Cockroackdb,

当我生成一个新用户时,帖子都很棒,然后将其转到我的数据库。 “ 但是,当我试图从中读取它确实错误,并给了我一个错误,说这不能序列化bigint。

我谷歌搜索了很多东西,并找到了一个修复程序(“ Json-bigint-patch”),但是现在没有遇到错误,而是返回了我的“ null”。 “

稍后我发现是否手动更改较小数字的自动化ID,我会根据自己的期望获得结果。 “

现在,我一直坚持下去,我不知道如何解决这个问题。

感谢您提前的帮助

:我真的很新

I'm having some issues with my rest api when I try to read from database.
My server stack right now is NestJS + Prisma + Cockroachdb

At first when I generated a new User, with a POST, all went great and got it to go to my database.
1
But when I tried to read from it it went really wrong and gave me an error, saying that couldn't serialize a BigInt.

I googled a lot and found a fix for it ('json-bigint-patch'), but now instead of getting an error it just returns me 'null'.
2

Later I found out if I manually change the autogenerated ID for a smaller number, I get the result as I was expecting.
3

So right now I'm stuck with this and I dont know how to solve this issue.

Thanks for your help in advance

Note: I'm really new at all this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文