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

Add _translations fields and dot-navigation to pluck and distinct

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 7.4.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible

      With the changes to pluck and distinct in MONGOID-5028, localized fields no longer return the entire translation hash on pluck and distinct:

      # Old Behavior
      Dictionary.all.pluck(:description)
      # => {"de"=>"deutsch-text", "en"=>"english-text"}
      
      # New Behavior
      Dictionary.all.pluck(:description)
      # => "deutsch-text"

      This ticket is to provide the ability for users to pluck or distinct a _translations field so that they can get the entire translations hash.

       Also, we added dot navigation to pluck and distinct so:

      # Old Behavior
      Band.pluck("labels.sales") 
      # => [{ 'sales' => "1E2" }]
      
      # New Behavior
      Band.pluck("labels.sales") 
      # = [BigDecimal("1E2")]

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: