2017-04-20 23 views
0

我遷移從MySQL我的應用程序的MongoDB但有些MongoDB中不工作的查詢:Laravel 5.2應用程序從MySQL遷移到MongoDB的,但查詢不能

$data = Post::where(\DB::raw("DATE_FORMAT(created_at,'%Y-%m-%d %H')""),Carbon::createFromTimestamp(time(),'America/New_York')->format('Y-m-d H'))->count(\DB::raw('DISTINCT postName')); 

在這裏,我不知道如何爲mongodb寫這個查詢。請幫忙。

回答

0

Laravel數據庫不支持mongodb。它支持四個數據庫:MySQL,Postgres,SQLite和SQL Server。

如果你想在PHP中使用MongoDB的,這將有利於:http://php.net/manual/en/set.mongodb.php

或發現https://packagist.org/

+0

我知道,我已經安裝了驅動程序,如果你看到我已經提到的第三方的MongoDB驅動一些查詢不起作用。如上述查詢。我正在尋找將上述查詢轉換爲mongodb。 – Mandy