Hi, I need to convert Mongo Document to DBObject (BasicDBObject).
I upload a file to mongo using GridFS and I want to set the metadata that I get in the document. I know that a Document is almost the same as a DBObject. I know I can do something like this:
Document doc = new Document();
BasicDBObject.parse(doc.toJson());
But is it useless very hard?
The gridFS method only setMetaData()accepts DBObject, so I need to convert it.
Is there a better way to do this rather than converting it to a string and vice versa?
source
share