1、建立一个新的mongodb库。
2、把当前的mongodb集合改为比如 log_data为log_data_201904062230。
3、把log_data_201904062230备份到新库中。
4、在获取数据的地方再连接新库的log_data_201904062230集合展示数据。
代码示例如下:
$where = array(); if( $product_id ) { $where['lq_product_id'] = $product_id; } if( $qrcode ) { $where['lq_qrcode'] = $qrcode; //$where['lq_qrcode'] ="75906.DRMWH.A.13_50.N"; } if( $lq_user) { $where['lq_user'] = $lq_user; } $page_list_num = 100; $cls_log = cls_app:: get_cls( 'log' ); $cls_log->set_collection( 'log_data' ); $list = $cls_log->get_list( $page, $page_list_num, $where, array( 'lq_time'=> -1 ) ); //去历史里拉数据 $cls_log_his = new cls_log ( 'bullfrog_history' ); $cls_log_his -> set_db( 'log' ); $cls_log_his -> set_collection( 'log_data_201904062230' ); $list_his = $cls_log_his->get_list( $page, $page_list_num, $where, array( 'lq_time'=> -1 ) ); $list_all = array_merge( $list, $list_his );
python学习网,大量的免费,欢迎在线学习!
Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务