1,官网提供的mongodb遍历脚本:官方文档地址:https://docs.mongodb.org/manual/tutorial/remove-documents/
>var arr = ["ab","cd","ef"]
>var show = function(value,index,ar){ print(value) }
>arr.forEach(show)
ab
cd
ef2,mongodb的模糊查询mongodb模糊查询参考:http://blog.csdn.net/5iasp/article/details/20714943,需要找出所有时间戳的数据记录,因为时间戳多是以数字开头,最近几年的都是14XXX的,所以正则表达式以14开头搜索,实现方式如下:mongos>useposswitched to dbposmongos>
db.paymentinfo.find({"paymentTime": {$regex:'14',$options:'i'}}).count();
mongos> db.paymentinfo.find({"paymentTime": {$regex:'144',$options:'i'}}).count();1995mongos>查询到有1995条记录,蛮多的,需要处理记录数不少。建立遍历函数:db.
...
继续阅读
(55)