title: Read image file into a MongoDB document's binary field via mongo shell script
body: <p>I would like to read an image file into a MongoDB document's binary field from mongo shell.  I can do this in Java with MongoDB Java driver.  However, I would like to be able to do with a mongo script from mongo shell.  Is this possible?</p>
  
  <p>For example, I would like to do this:</p>
  
  <p>D:\mongo\bin> mongo --shell myscript.js</p>
  
  <p>where myscript.js is as follow:</p>
  
  <pre><code>conn = new Mongo();
  db = conn.getDB("mydb");
  db.mycoll.remove();
  db.mycoll.insert( { name : "LCD monitor",
                      thumbnail : Binary(0, **cat("D:\\images\\lcdmonitor.jpg")**)
                    } );
  </code></pre>
  
  <p>As is, the use of cat() method gives "InternalError: buffer too small (anon):1", as cat() is for reading text file only.</p>
  
  <p>Which method / function in place of cat() should I use to make this work?
  Can this be done in the mongo shell at all?</p>