Open
Description
- Laravel-mongodb Version: 3.8.5
- PHP Version: 8.0
- Database Driver & Version:
4.2.3
Description:
I'm using raw query to get data from DB.
There is a few $lookup
I use. One for rounds
collection another one for the users
.
'$lookup' => [
'from' => 'users',
'localField' => 'user_mongo_id',
'foreignField' => '_id',
'as' => 'user'
]
...
'$lookup' => [
'from' => 'rounds',
'localField' => 'round_mongo_id',
'foreignField' => '_id',
'as' => 'proposal_round'
]
Parent model has 1 round and 1 user. (1 to 1 relation)
For some reason user
casts differently from round
:
Round
relation is an object with string_id
and stringified dates.User
is an array of 1 single object, with{ _id: $oid: '.....'}
and dates like
"created_at": { "$date": { "$numberLong": "1659863891000" } }
User
:
Round
:
Expected behaviour
I expect user to be an object (not array of objects) with stringified properties _id
and dates (not displayed as an objects).
Metadata
Metadata
Assignees
Labels
No labels