pluck not working as expected on subdocument

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 5.0.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have a Mongo shell query working and I'm trying to duplicate it with Mongoid.
      Here is what works in the Mongo shell
      {{db.getCollection('accounts').find(

      {field1: 'test'}

      ,

      {'field1': 1, 'subdocs.field2': 1}

      )}}
      I'm thinking the pluck method should work, but it always returns nil for subdocs.field2 even though there is a value in the document.
      >>Account.where(field1: 'test').pluck(:field1, 'subdocs.field2')
      [['test', nil], ['test', nil]]
      Should this work?

            Assignee:
            Emily Stolfo (Inactive)
            Reporter:
            steveo7
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: