mongodb/gridfs java-driver use with utf-8 meta data
I am trying to use GridFS to load a file along with some meta data using the java-driver. (2.5.3) Things work fine as long as the meta-data is in ASCII. But I get an exception - the mom开发者_如何学Goent I try and set a UTF8 string with non ascii characters. String MetaData = "学海"; GridFS gridFS = new GridFS(db); GridFSInputFile inputFile = myFS.createFile(new File(filePath)); DBObject dbObj = inputFile.getMetaData() dbObj.put("metaData", MetaData); ----> Get exception here (if non- ascii data)
inputFile.save();
Are you able to use UTF8 strings when storing regular documents?
Based on your description, it sounds like you're trying to report a bug rather than ask a question.
MongoDB uses a JIRA system for reporting bugs. If you can include the code you are using this will help the driver developer correct the issue.
精彩评论