I am using GridFS MongoDB via JAVA Driver 2.13
.
I inserted a file:
File file = new File("/home/dev/abc.pdf");
GridFSInputFile inputFile = gfs.createFile(file);
I removed it using its _id which is p_id in this case:
DBObject query = new BasicDBObject("_id",p_id)
gfs.remove(query);
I came to know GridFS maintains compound Index on the primary key of metadata file and number of the chunk.
Are these indexes deleted after deleting the file in GridFS?
Index changes happen synchronously with data changes. If you deleted a file, index was updated at the same time.
Are these indexes deleted after deleting the file in GridFS?
You're, likely, just confused about terminology, so I'll clarify. "Deleting an index" means un-indexing a collection (removing index data for all documents and not adding it in the future). What happens here is "index update" where certain entries of the index are updated when you change/insert/remove corresponding data documents.