I have an array of custom datatype such as a class or a structure and would like to store it in mongodb as binary data. How would I go about adding and retrieving that array from mongodb? I need to do this via the C++ driver. I was able to add and retrieve for simple arrays using appendbinData and getbinData but I can't find a way to do this for arrays of custom datatypes.
Asked
Active
Viewed 180 times
0
-
try serialization, such as msgpack, protobuf or json or xml – Dmitry Ledentsov Jan 16 '14 at 18:40
-
All of these require you to define a way to serialize the datatype. Though what I am using is a complex datatype from a library. Is it possible to just dump this data and extract without having to go through the code of the complex datatype and finding out ways to serialize each component? – Marcus_Aurelius Jan 16 '14 at 19:16
-
For example the answer [here](http://stackoverflow.com/a/1110271/3203830). – Marcus_Aurelius Jan 16 '14 at 19:24
-
you can dump anything you want, but in c++ you need to know the details of your type. You can help yourself with libraries to write as little boilerplate as possible – Dmitry Ledentsov Jan 16 '14 at 20:52