Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1690

nested embedded_in work incorrectly when object was saved

      see a code example:

      There are three models , as this:

      class User
        include Mongoid::Document
        embeds_many :projects
      end
      
      class Project
        embedded_in :user
        embeds_many :tasks
      end
      
      class Task
        embedded_in :project
      end
      

      Now create them to use:

      user = User.new
      project = Project.new
      task = Task.new
      project.tasks << task
      user.projects << project
      user.save
      

      Then query:
      {{user.reload.projects[0].tasks }}
      output
      [] !!

      I hope it should output [task]

      I found this describe about this:
      Append one or many child addresses, saving them if the person is persisted

      Thx.

            Assignee:
            Unassigned Unassigned
            Reporter:
            windy windy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: