0

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.

4
  • try serialization, such as msgpack, protobuf or json or xml Commented Jan 16, 2014 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? Commented Jan 16, 2014 at 19:16
  • For example the answer here. Commented Jan 16, 2014 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 Commented Jan 16, 2014 at 20:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.