Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-992

Using :fields option on find is ignored

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu 14.04 LTS
      Ruby on Rails (Rails 4.2.2, Ruby 2.2.2)
      Mongoid 5.0.0.beta

      Description

      I'm trying to use the fields option on the find method as explained here:
      https://github.com/mongodb/mongo-ruby-driver/wiki/Tutorial#selecting-a-subset-of-fields-for-a-query

      On my Rails console I do something like:
      client = Mongoid::Clients.default
      client[:entities].find({},:fields=>["_id"]).to_a

      and the result includes all fields from the Entity model. Same result as when I don't add the :fields parameter.

      Is this an issue in how I'm requesting the fields to be returned or the option is being ignored and it's actually a bug?

        Attachments

          Activity

            People

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            marcocanderle Marco Canderle
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: