mongo
MongoDB shell version: 3.0.2
connecting to: test
> use testdb
switched to db testdb
> db.user.insert({id:1,name:"用户1"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:2,name:"用户2"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:3,name:"用户3"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:4,name:"用户4"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:5,name:"用户5"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:6,name:"用户6"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:7,name:"用户7"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:8,name:"用户8"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:9,name:"用户9"});
WriteResult({ "nInserted" : 1 })
> db.user.insert({id:10,name:"用户10"});
WriteResult({ "nInserted" : 1 })
>
> db.user.find();
{ "_id" : ObjectId("574d7aae8780832e6c4e27b4"), "id" : 1, "name" : "用户1" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27b5"), "id" : 2, "name" : "用户2" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27b6"), "id" : 3, "name" : "用户3" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27b7"), "id" : 4, "name" : "用户4" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27b8"), "id" : 5, "name" : "用户5" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27b9"), "id" : 6, "name" : "用户6" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27ba"), "id" : 7, "name" : "用户7" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27bb"), "id" : 8, "name" : "用户8" }
{ "_id" : ObjectId("574d7aaf8780832e6c4e27bc"), "id" : 9, "name" : "用户9" }
{ "_id" : ObjectId("574d7ab08780832e6c4e27bd"), "id" : 10, "name" : "用户10" }
mongoexport -d testdb -c user -o /tmp/user.json
2016-05-31T20:00:32.257+0800 connected to: localhost
2016-05-31T20:00:32.286+0800 exported 10 records
cat /tmp/user.json
{"_id":{"$oid":"574d7aae8780832e6c4e27b4"},"id":1,"name":"用户1"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27b5"},"id":2,"name":"用户2"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27b6"},"id":3,"name":"用户3"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27b7"},"id":4,"name":"用户4"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27b8"},"id":5,"name":"用户5"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27b9"},"id":6,"name":"用户6"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27ba"},"id":7,"name":"用户7"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27bb"},"id":8,"name":"用户8"}
{"_id":{"$oid":"574d7aaf8780832e6c4e27bc"},"id":9,"name":"用户9"}
{"_id":{"$oid":"574d7ab08780832e6c4e27bd"},"id":10,"name":"用户10"}
mongoexport -d testdb -c user --type csv -o /tmp/user.csv 2016-05-31T20:01:05.393+0800 Failed: CSV mode requires a field list mongoexport -d testdb -c user --type csv -f "id" -o /tmp/user.csv 2016-05-31T20:01:46.510+0800 connected to: localhost 2016-05-31T20:01:46.534+0800 exported 10 records cat /tmp/user.csv id 1 2 3 4 5 6 7 8 9 10
> db.user.drop(); true > db.user.find(); >
mongoimport -d testdb -c user --file /tmp/user.json 2016-05-31T20:10:22.240+0800 connected to: localhost 2016-05-31T20:10:22.287+0800 imported 10 documents
mongoimport -d testdb -c user --type csv --headerline --file /tmp/user.csv 2016-05-31T20:11:28.975+0800 connected to: localhost 2016-05-31T20:11:29.003+0800 imported 10 documents
mongodump -d testdb -c user -o /tmp 2016-05-31T20:18:25.813+0800 writing testdb.user to /tmp/testdb/user.bson 2016-05-31T20:18:25.818+0800 writing testdb.user metadata to /tmp/testdb/user.metadata.json 2016-05-31T20:18:25.849+0800 done dumping testdb.user
> db.user.drop(); true > db.user.find(); >
mongorestore -d testdb -c user /tmp/testdb/user.bson 2016-05-31T20:21:23.050+0800 checking for collection data in /tmp/testdb/user.bson 2016-05-31T20:21:23.084+0800 reading metadata file from /tmp/testdb/user.metadata.json 2016-05-31T20:21:23.088+0800 restoring testdb.user from file /tmp/testdb/user.bson 2016-05-31T20:21:23.153+0800 restoring indexes for collection testdb.user from metadata 2016-05-31T20:21:23.156+0800 finished restoring testdb.user 2016-05-31T20:21:23.156+0800 done
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有