title: Though I have a record in database, it's giving "Mongoid::Errors::DocumentNotFound"
body: <p>Though I have the record with id 13163 (<code>db.locations.find({_id: 13163})</code>), it's giving me error:</p>
  
  <p><strong>Mongoid::Errors::DocumentNotFound in LocationsController#show</strong></p>
  
  <blockquote>
    <p>Problem: Document(s) not found for class Location with id(s) 13163.
    Summary: When calling Location.find with an id or array of ids, each
    parameter must match a document in the database or this error will be
    raised. The search was for the id(s): 13163 ... (1 total) and the
    following ids were not found: 13163. Resolution: Search for an id that
    is in the database or set the Mongoid.raise_not_found_error
    configuration option to false, which will cause a nil to be returned
    instead of raising this error when searching for a single id, or only
    the matched documents when searching for multiples.</p>
  </blockquote>
  
  <pre><code># Use callbacks to share common setup or constraints between actions.
  def set_location
    @location = Location.find(params[:id])
  end
  </code></pre>
  
  <p><strong>locations_controller.rb:</strong></p>
  
  <pre><code>class LocationsController &lt; ApplicationController
    before_action :set_location, only: [:show, :edit, :update, :destroy]
  
    # GET /locations
    # GET /locations.json
    def index
      @locations = Location.all
    end
  
    # GET /locations/1
    # GET /locations/1.json
    def show
    end
  
    private
      # Use callbacks to share common setup or constraints between actions.
      def set_location
        @location = Location.find(params[:id])
      end
  
      # Never trust parameters from the scary internet, only allow the white list through.
      def location_params
        params.require(:location).permit(:loc_name_en, :loc_name_jp, :channel)
      end
  end
  </code></pre>
  
  <p>Setting up the option <code>raise_not_found_error: false</code> is not the case as I do have a document in database.</p>
  
  <hr>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>Big thanks to <a href="https://stackoverflow.com/users/479863/mu-is-too-short">@mu is too short</a> for giving me a hint.</p>
  
  <p>The problem can be solved in 2 ways:</p>
  
  <ol>
  <li>Declare <code>field :_id, type: Integer</code> in the model <code>location.rb</code></li>
  <li>Or converting the passing parameter to Integer like <code>Location.find(params[:id].to_i)</code> in <code>locations_controller.rb</code> as shown below in the <strong>@mu is too short</strong>'s answer</li>
  </ol>