或者
问答详情页顶部banner图
您的位置:首页 >推广 > 其他 > 其他 > mongodb 导入集合 是什么意思

mongodb 导入集合 是什么意思

提问者:无缘的缘分  |   分类:其他  |   浏览177次  |   悬赏分:4积分 2017-03-20 16:23:16

我要回答

提 交

匿名

  • 老蒋

    mongo@redhatB ~]$ mongo MongoDB shell version: 2.2.1 connecting to: test > show dbs; local (empty) skytf 0.0625GB test 0.0625GB > show collections; system.indexes test_2 things > use skytf; switched to db skytf > show collections; system.indexes test_1 备注:我们的目标是将 test 库的集合 things 导入到库 skytf 中。 一 以JSON 格式导入导出 --1.1 从源库导出集合 [mongo@redhatB tf]$ mongoexport -h 127.0.0.1 -d test -c things -v -o things.json Sat Nov 17 10:21:27 creating new connection to:127.0.0.1:27017 Sat Nov 17 10:21:27 BackgroundJob starting: ConnectBG Sat Nov 17 10:21:27 connected connection! connected to: 127.0.0.1 exported 30 records 备注:导出库 test_2 的集合 things,从上面看出导出了 30 条记录。 --1.2 导入集合到目标库 [mongo@redhatB tf]$ mongoimport -h 127.0.0.1 -d skytf -c things --file things.json connected to: 127.0.0.1 Sat Nov 17 10:28:30 imported 30 objects 备注:从上看出导入了 30 个文档。 --1.3 查看目标库 > use skytf; switched to db skytf > show collections; system.indexes test_1 things > db.things.count(); 30

    2017-05-25 15:28:01
    评论0  |   0
问答详情中间banner