mongoDB: store audio files (Best way) using python
<p>I've a bunch of audio files (.wav) and I'd like know from you guys, what's the best way to store them in mongoDB? 
What I'm doing today is, just storing the path of the file.(as you can see below).
But I think it's not good because I'm creating a "fake reference" to the file and I wonder If by chance I delete the file, how could I consist it?</p>

<pre><code>{
    "_id" : ObjectId("57c0a06cd92f49222ce2f42d"),
    "eps" : "GPSP",
    "terminal" : 989638523,
    "main_path" : "W:\\Python\\Speech\\audio\\teste\\teste_9",
    "motivo" : "Classic",
    "audio" : [ 
        {
            "path" : "W:\\Python\\Speech\\audio\\teste\\teste_9\\01_audio.wav",
            "confidence" : 0.8332507,
            "transcript" : "AlÃ´ bom dia com quem eu falo",
            "sequence" : 1
        }, 
        {
            "path" : "W:\\Python\\Speech\\audio\\teste\\teste_9\\02_audio.wav",
            "confidence" : 0.90813386,
            "transcript" : "Um novo benefÃ­cio pra minha da senhora, sem impostos e nada mais do que isso",
            "sequence" : 2
        }
}
</code></pre>

<p>Thank you,</p>

<p>Take a look at MongoDB <a href="https://docs.mongodb.com/manual/core/gridfs/" rel="nofollow"><code>gridfs</code></a>:</p>

<blockquote>
  <p>GridFS is a specification for storing and retrieving files that exceed the
  BSON-document size limit of 16 MB</p>
</blockquote>

<p>Using pymongo you can put files inside like this:</p>

<pre><code>from pymongo import MongoClient
import gridfs

fs = gridfs.GridFS(db)
file_id = fs.put(open( r'audio.wav', 'rb')
</code></pre>

python mongodb audio