Read image file into a MongoDB document's binary field via mongo shell script
问题 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? For example, I would like to do this: D:\mongo\bin> mongo --shell myscript.js where myscript.js is as follow: conn = new Mongo(); db = conn.getDB("mydb"); db.mycoll.remove(); db.mycoll.insert( { name : "LCD monitor", thumbnail : Binary(0, **cat("D:\\images\