Skip to content

Push does not take MongoDate #414

Closed
Closed
@alwaysanirudh

Description

@alwaysanirudh

Hi,

I have been facing this issue after the update. I'm Trying to push an array to mongo collection described as follows:

$activityItem = [ 'text' => 'blah blah', 'date' => new MongoDate() ];
DB::collection('customers')->where('name', 'XYZ')->push('activity', $activityItem);

But I get a error when I run it.

Object of class MongoDate could not be converted.

I tried to do a raw query and it did work fine.
I think there is a problem when we try to do a push and Base model tries to convert the data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions