2017-06-01 51 views
0

我想導出mongodb上一個字段的具體值。我的mongoexport的輸出是這樣的:從mongodb導出具體值

{"_id":"00:XX:XX:2a:15:e08503904736321657210145581","timestamp":1496095264,"MAC":"00:XX:XX:2a:15:XX","RSSI":24,"manufacturer":"30:XX:X"} 

{"_id":"00:XX:XX:2b:10:b08503818454462501125707070","timestamp":1496181546,"MAC":"00:XX:XX:2b:10:XX","RSSI":29,"manufacturer":"b0:XX:XX"} 

而這與5M值。是否可以僅導出一個「MAC」的值。這是我的突擊隊輸出值:

mongoexport -u usser -p pwd --host host:port -d pingsDB -c 2017-05-25 --authenticationDatabase admin -f "timestamp,MAC,RSSI,manufacturer" -o mongo.csv 

非常感謝。

回答

0

回答到@JonLuca,它的工作做的語法修復:

mongoexport -u usser -p pwd --host host:port -d pingsDB -c 2017-05-25 
--authenticationDatabase admin -f "timestamp,MAC,RSSI,manufacturer" 
--query { "MAC":"00:XX:XX:2b:10:XX"} -o mongo.csv 

mongoexport -u usser -p pwd --host host:port -d pingsDB -c 2017-05-25 
    --authenticationDatabase admin -f "timestamp,MAC,RSSI,manufacturer" 
    --query '{ "MAC":"00:XX:XX:2b:10:XX"}' -o mongo.csv 

取看看' '之前和之後ter { }

謝謝!