Use the mongofiles utility to access data inserted into the Java GridFS API

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?

+3
source share
2 answers

, mongo admin , . phpMoAdmin. . . , .

+1
+1

Source: https://habr.com/ru/post/1773928/


All Articles