两个版本的mongoid first_or_create有什么区别

发布于 2025-02-04 20:06:26 字数 319 浏览 2 评论 0原文

我正在浏览mongoid文档 https://mongoid.github.io//mongoid.github.io// old/en/en/mongoid/docs/querying.html

,我尚不清楚first_or_create& amp; first_or_create!

有人可以帮我理解吗?

I was going over mongoid documentation https://mongoid.github.io/old/en/mongoid/docs/querying.html

and it is not clear to me what is difference between first_or_create & first_or_create!

Can someone help me understand ?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深爱成瘾 2025-02-11 20:06:26

我认为您可以看一下

https://mongoid.github。 io/old/old/en/mongoid/docs/persistence.html

create = =插入文档或多个文档

create! =插入文档或多个文档文档进入数据库,如果发生验证错误,则会引起错误。

I think you could take a look at

https://mongoid.github.io/old/en/mongoid/docs/persistence.html

create = Insert a document or multiple documents into the database

create! = Insert a document or multiple documents into the database, raising an error if a validation error occurs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文