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

Error wiping embeds_many collection

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: