title: Django mongoengine rendring pdf file
body: <p>I am trying to open my pdf file from my search result as i am using mongoengine in django. Recently i shift from sql to mongodb.</p>
  <p>how to open pdf file from frontend mongoengine django</p>
  <p>search.html for sql db.below code is for sqldb and i am looking for similar to this in mongoengine django</p>
  <p>'''</p>
  <pre><code>&lt;h1&gt;You searched for {{ searched }}  &lt;/h1&gt;
      &lt;br/&gt;
      {% for i in Document %}
       &lt;a href=&quot;{{ i.file.url }}&quot; class=&quot;btn btn-outline-secondary&quot; target=&quot;_blank&quot;&gt;
       {{i.filename}}&lt;/a&gt;
      &lt;br/&gt; 
  </code></pre>
  <p>'''</p>
  <p>This is my search function</p>
  <p>'''</p>
  <pre><code>def search(request):
      if request.method == &quot;POST&quot;:
          if request.POST.get('searched'):                                       
              searched = request.POST.get('searched')
              dbname = my_client['resume']
              collection_name = dbname[&quot;user_resumes&quot;]
              collection_name.create_index([(&quot;num2&quot;,&quot;text&quot;)])
              Document = collection_name.find({&quot;$text&quot;: {&quot;$search&quot;: str(searched)}},{&quot;score&quot;: {&quot;$meta&quot;: &quot;textScore&quot;}}).sort([(&quot;score&quot;,{&quot;$meta&quot;:&quot;textScore&quot;})])   
           return render(request,'search.html'{'searched':searched,'Document':Document})
  '''
  </code></pre>
  <p>if you have any reference please share it with me.</p>