I am aware that ODM purpose is mapping, but I'm also curious if I can save a JSON Object without mapping it to any class. Or with mapping it to a class but having only one object value $object.
I've managed to do this when ever I would have an array of objects, for instance:
[
{
"id":28,
"Title":"Sweden"
},
{
"id":56,
"Title":"USA"
},
{
"id":89,
"Title":"England"
}
]
I've managed to save that array of objects without mapping the id, Title, and other fields which are not there.
/**
* @MongoDB\Field(name="object", type="hash")
*/
protected $object = array();
My question is if I can do the same thing only for the JSON Objects, not array objects. For instance, I'd like to save this object without mapping every single key:
{
"id":28,
"Title":"Sweden"
},
{
"id":56,
"Location":"New York"
},
{
"id":89,
"Something": {
"test": "test
}
}