0

How would you write a query like this

db.collection.find({$expr: {$lte: [{ $mod: [ '$created_at', 3600 ] }, 59]}});

using the jenssegers/laravel-mongodb extension

2
  • did you find a solution for this? Commented Jul 19, 2018 at 14:33
  • I couldn't find a way to write that query using the jenssegers/laravel-mongodb extension, so I fetched the records and implemented the logic to filter them myself in the code. Commented Jul 20, 2018 at 14:45

1 Answer 1

1

use the raw expression following the documentation

YourModel::whereRaw([
            '$expr' => [
                '$lte' => [
                    [
                        '$mod' => [
                            '$created_at', 3600
                        ],
                        59
                    ]
                 ]
            ]
        ])->get();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.