Mongo data_binary

26 views
Skip to first unread message

Dmitry Samotoy

unread,
Dec 22, 2013, 6:39:30 AM12/22/13
to prudence-...@googlegroups.com
With changes engine for mongoDB, extraction of data_binary of data doesn`t work. How to receive only $binary?

function test() {
    var file = BSON.from(collection.findOne(BSON.to(query)))
    return JSON.to(file.data)
}

[{"$binary":"iVBOR...",","$type":"0"}]

Tal Liron

unread,
Dec 22, 2013, 6:43:37 AM12/22/13
to prudence-...@googlegroups.com
The returned value should be a JVM array of bytes: BSON conversion recognizes this type. As far as I can tell, nothing changed in the Java MongoDB driver for this.

It's only when you convert it to JSON does it try to be smart and use the extended notation. Instead of converting to JSON, try to do something else with "file.data". For example, you can try printing the length of the byte array.
--
You received this message because you are subscribed to the Google Groups "Prudence Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prudence-commun...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages