WARN -- : MONGODB | Unsupported client option 'raise_not_found_error'. It will be ignored

894 Views Asked by At

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
2

There are 2 best solutions below

1
Aniket Tiwari On

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
0
Travis On

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