Yii2 mongodb activerecord find by date

Hi,

Track @stackoverflow.com

In mongodb my creaeted_on values is like YYYY-mm-dd H:i:s e.g 2017-08-03 11:51:05. but while searching outputs i have to pass only date YYYY-mm-dd but it is not working with Yii2 mongodb activerecord but it is working from terminal.

Mongodb activerecord :




$output  = DeviceOutput::find()

		->where(["created_on"=>"/^$date/"])

		->one();



Terminal Command :


 

db.device_output.find({"created_on":/^2017-08-03/})

Maybe


->where("created_on => /^$date/")

Is the ‘/^.../’ slashed thing a mongodb thing?

It must required an array for where clause in Mongodb activerecord.

Error :


Invalid Parameter – yii\base\InvalidParamException


Condition should be an array

Maybe SQL requires "gte" instead of "=>"

Just spit-balling :)