I tried:
$tweets = Tweet::find()->where(['<=', 'tweet_time', new \MongoDate()])->all();
But it throws:
Invalid Parameter – yii\base\InvalidParamException
Found unknown operator in query: <=
How to express it properly?
Thanks.
I tried:
$tweets = Tweet::find()->where(['<=', 'tweet_time', new \MongoDate()])->all();
But it throws:
Invalid Parameter – yii\base\InvalidParamException
Found unknown operator in query: <=
How to express it properly?
Thanks.
try
$tweets = Tweet::find()->where(‘tweet_time<=:t’, [’:t’=>new \MongoDate()])->all();
not checked, but it may work
no, it doesn’t
any help?
You should use MongoDB conditional operators:
$tweets = Tweet::find()->where(['tweet_time' => ['$lte' => new \MongoDate()]])->all();
Thanks, Paul!