两个版本的mongoid first_or_create有什么区别
我正在浏览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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以看一下
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.