title: issue in fetching one element in mongodb rest api using python
body: <p>I am trying to fetch the data for 1 id and I am getting Nonetye object in return.</p>
  <pre><code>@app.route('/api/dd/&lt;id&gt;',methods=['GET','PUT','DELETE'])
  def api_each_bmat(id):       
      if request.method == &quot;GET&quot;:
          music_obj = music.objects(id=id).first()
  </code></pre>
  <p><strong>error</strong></p>
  <pre><code>[2021-08-04 15:10:35,454] ERROR in app: Exception on /api/bmat/&quot;T0350190010&quot; [GET]
  Traceback (most recent call last):
    File &quot;C:\Users\rishi\anaconda3\lib\site-packages\flask\app.py&quot;, line 2447, in wsgi_app
      response = self.full_dispatch_request()
    File &quot;C:\Users\rishi\anaconda3\lib\site-packages\flask\app.py&quot;, line 1953, in full_dispatch_request
      return self.finalize_request(rv)
    File &quot;C:\Users\rishi\anaconda3\lib\site-packages\flask\app.py&quot;, line 1968, in finalize_request
      response = self.make_response(rv)
    File &quot;C:\Users\rishi\anaconda3\lib\site-packages\flask\app.py&quot;, line 2097, in make_response
      raise TypeError(
  TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
  127.0.0.1 - - [04/Aug/2021 15:10:35] &quot;GET /api/bmat/%22T0350190010%22 HTTP/1.1&quot; 500 -
  </code></pre>