mongo_Linux下不进入数据库查数据
如果mongo中存在表 db.NotificationEvent : 数据如下
{ "_id" : ObjectId("5dba4f650088f730f5dd6083"), "status" : 1, "checked_remark" : "", "infosecurity" : 10, "create_date" : 1572451200, "description" : "主机访问了XCodeGhost病毒通信域名", "accepted_at" : 0, "dispatch_date" : 0, "hole_id" : "", "dealt_at" : 0, "infosecuritysub" : 113, "deal_duration" : 0, "rejected_remark" : "", "found_at" : 1572490877, "dealt_remark" : "", "expired_at" : 0, }
/mongodb/bin/mongo --port 27017 --eval 'db.NotificationEvent.find({"found_at" : 1572490877},{_id:0, description:1})' 数据库名 | grep -vE '(MongoDB|127.0.0.1|UUID)'
则显示出:
{"description" : "主机访问了XCodeGhost病毒通信域名"}
如果要显示 "主机访问了XCodeGhost病毒通信域名" 则可以在后面加上切片 过滤 | cut -c 21-44
/mongodb/bin/mongo --port 27017 --eval 'db.NotificationEvent.find({"found_at" : 1572490877},{_id:0, description:1})' 数据库名 | grep -vE '(MongoDB|127.0.0.1|UUID)' | cut -c 21-44