1

I need to setup option in mongoid.yml. It work in development but production in heroku gave the ignore warning message. Is anyone experience and how to fix this ?

W, [2017-04-05T02:04:09.447207 #4]  WARN -- : MONGODB | Unsupported client option 'raise_not_found_error'. It will be ignored.
W, [2017-04-05T02:04:09.449089 #4]  WARN -- : MONGODB | Unsupported client option 'belongs_to_required_by_default'. It will be ignored.
W, [2017-04-05T02:04:09.449176 #4]  WARN -- : MONGODB | Unsupported client option 'consistency'. It will be ignored.

In mongoid.yml

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>
      options:
        raise_not_found_error: false
        belongs_to_required_by_default: false
        consistency: :strong
PKul
  • 1,691
  • 2
  • 21
  • 41

2 Answers2

0

It is the error Mongo db gives when it tries to find any record and it doesn't match in database. In order to resolve this

Add this line in your production configuration
raise_not_found_error: false

mongoid.yml
production:
  clients:
    default:
      database: database_name
      hosts:
        - localhost:27017
      options:
        read:
          mode: :primary
        max_pool_size: 1
        raise_not_found_error: false
Aniket Tiwari
  • 3,561
  • 4
  • 21
  • 61
0

belongs_to_required_by_default doesn't go under clients > default > options. It should be defined under your environment:

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>            
  options:
    raise_not_found_error: false
    belongs_to_required_by_default: false
Travis
  • 3,156
  • 3
  • 21
  • 27