-
Notifications
You must be signed in to change notification settings - Fork 1.4k
-
Hi,
I've just upgraded my laravel version from 5.7 to 8. When using a raw query, example:
$model = Foo::raw(function ($collection) use ($bar_id) {
return $collection->aggregate([
['$match' => [ "id" => $bar_id ]],
['$lookup' => [
'from' => 'seasons',
"localField" => 'bar_id',
"foreignField" => 'id',
"as" => 'bar_details'
]]
]);
});
I used to get the properties of each item as arrays and objects, but they are now BSONArrays, BSONDocuments..
So if documents looked like this:
{
id: 1,
somearray: ['foo', 'bar', 1,2],
someobject: {foo: 'bar', ping: 'pong'}
}
and did something like $model[0]->somearray,
It now shows like this:
MongoDB\Model\BSONArray {#1853 ▼
-storage: array:4 [▶]
flag::STD_PROP_LIST: false
flag::ARRAY_AS_PROPS: false
iteratorClass: "ArrayIterator"
}
Just wondering how to convert it to it's proper state again.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment