After updating from a fairly old version (1.12.x) to 1.19 yesterday, I've expirenced some issues with the push function.
When I push a dictionary into an array which already has one element, the added value will be transformed from a dictionary to an array.
e.g.
the current situation in the DB document looks like this:
{
...
array : [
{
"data" : {},
"since" : NumberLong(1444640066),
"until" : NumberLong(1475744066),
"addFilter" : {},
"refreshtime" : NumberLong(1475744066)
}
]
}
a new element should be added to the array with the same structure by using the doc->push() function, as follows:
$dataset = [
'data' => [...],
'since' => time(),
'until' => time(),
'addFilter' => [...],
'refreshtime' => time()
];
$doc->push( 'array', $dataset );
the result is the following structure
{
...
array : [
{
"data" : {},
"since" : NumberLong(1444640066),
"until" : NumberLong(1475744066),
"addFilter" : {},
"refreshtime" : NumberLong(1475744066)
},
[
{},
NumberLong(1444640066),
NumberLong(1444640066),
{},
NumberLong(1444640066),
]
]
}
I would appreciate your help with this. thanks a lot in advance.
After updating from a fairly old version (1.12.x) to 1.19 yesterday, I've expirenced some issues with the push function.
When I push a dictionary into an array which already has one element, the added value will be transformed from a dictionary to an array.
e.g.
the current situation in the DB document looks like this:
a new element should be added to the array with the same structure by using the doc->push() function, as follows:
the result is the following structure
I would appreciate your help with this. thanks a lot in advance.