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

Error wiping embeds_many collection

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I'm having trouble deleting the records in an embeds_many collection on MongoHQ via MongoID.

      Decks embeds_many Cards

      When I call
      @deck.cards = []
      or
      @deck.cards.delete_all

      I get: Cannot apply $push/$pushAll modifier to non-array

      Alternatively, if I delete the records individually, the cards collection gets replaced with a hash instead of an Array.

      Code is at
      http://github.com/DanielHeath/Cards/blob/delete/app/models/deck.rb

      Line 19 can be replaced with self.cards = [] or self.cards.delete_all

            Assignee:
            Unassigned Unassigned
            Reporter:
            DanielHeath Daniel Heath [X]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: