I can successfully insert and extract data from MongoDB GridFS in Java. However, when I try to access this data on the command line using mongofiles, I cannot find it. Java insert code:
GridFS fs = new GridFS(Mongo.getStaticMongo("localhost:27017").getDB("myDb"), "myCollection");
try {
GridFSInputFile inputFile = fs.createFile(content.getFile());
inputFile.put(MONGO_KEY, content.getId().toString());
inputFile.save();
} catch (IOException e) {
throw new RuntimeException(e);
}
Command line:
>mongofiles --host localhost:27017 -d myDb -c myCollection -vvvvvv list
Tue Nov 09 11:48:01 creating new connection to:localhost:27017
connected to: localhost:27017
>
Nothing returns ... where does the Java GridFS driver put these files?
source
share