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

Using :fields option on find is ignored

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      Ubuntu 14.04 LTS
      Ruby on Rails (Rails 4.2.2, Ruby 2.2.2)
      Mongoid 5.0.0.beta

      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?

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

              Created:
              Updated:
              Resolved: