Is it possible to delete an embedded document in Mongoid without saving?

Definitely related to this question , but since there was no answer, I feel I have to ask again. Is there a way to remove an inline document from a Mongoid embeds_many relationship without saving?

I want to change the array of embedded documents in memory - and then save all the changes with a single UPDATE operation. In particular, I would like to:

  • Change arrays of embedded documents (add embedded doc / remove embedded doc / edit embedded doc / etc).
  • Other changes to TLDs are possible.
  • Save all changes with a single database call.
+4
source share
2

Mongoid , . Mongoid .

, , Mongoid mongo-ruby-driver.

0

update_all()

Ex: Joe

User.update_all(name: 'Joe')

, .

-1

Source: https://habr.com/ru/post/1540812/


All Articles