The mongofiles tool, which uses the C++ driver, will create an index on
{files_id:1, n:1}if it doesn't already exist for the fs.chunks collection when storing a file. That index should be created as unique, but it isn't currently. Many drivers (pymongo at least) do this already.