Skip to content

Question: Query db by MongoDate #51

Closed
@milosh012

Description

@milosh012

Hello,

first want to say that your extension is awesome!

I have one question... I have mongodb collection saved with models that have column type "Date". When I access that collection I see that column with Date type is actually MongoDate object.

My question is how I can query by that column? I have tried next scenarios with no success:

DB::connection('mongodb')->collection('names')->where('date', '<', new MongoDate())
DB::connection('mongodb')->collection('names')->where('date', '<', new DateTime())
DB::connection('mongodb')->collection('names')->where('date', '<', time())
DB::connection('mongodb')->collection('names')->where('date', '<', date('Y-m-d'))

Thanks,
Milos

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