0
我有一些收藏:如何在MongoDB + PHP中將數據按天分組?
$data_to_insert = array('date'=> $current_date, 'str_date' => $today_date_str, 'user_id' => intval($post->post_author), 'post_id' => $post->ID, 'user_ip' => current_user_ip());
我需要一些數據從數據庫蒙哥(它的工作):
$start = new MongoDate(strtotime("-14 days"));
$end = new MongoDate(strtotime(date("Y-m-d H:i:s")));
$last_day_query = $hits_collection->find(array("date" => array('$gt' => $start, '$lte' => $end), "user_id" => $current_user->ID));
如何,我需要修改我的查詢得到的數據按天分組?
不知道爲什麼這有兩種選票,他甚至沒有解釋他在做什麼。此外,這僅適用於假設'str_date'是一天而且也不需要'$ project'的情況,事實上,由於文檔從項目傳遞到組的方式,此聚合不起作用。 – Sammaye 2013-03-04 13:42:30
它真的工作:)在str_date我有「2013-03-03」類似的數據。 – inlanger 2013-03-04 14:21:28