我们直接从gridfs中取文件列表时取出来的文件_id为:
"_id": { "timestamp": 1587091947, "counter": 9048602, "time": 1587091947000, "date": "2020-04-17T02:52:27.000+0000", "timeSecond": 1587091947, "machineIdentifier": 11229770, "processIdentifier": 31009 },
如果要转换成正常的文件id 其实很简单 :
ObjectId objectId=(ObjectId) map.get("_id"); map.put("_id",objectId.toString());