Install mongoDB-org-tools [lwk@qwfys:~]$ sudo dnf install monGodb-org-tools [sudo] passWord for lwk: Last metadata expi
[lwk@qwfys:~]$ sudo dnf install monGodb-org-tools
[sudo] passWord for lwk:
Last metadata expiration check: 1:05:23 ago on Thu 16 Jul 2020 11:58:35 AM CST.
Dependencies resolved.
==============================================================================================================================================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================================================================================================================================
Installing:
mongodb-org-tools x86_64 4.2.8-1.el8 mongodb-org 62 M
Transaction Summary
==============================================================================================================================================================================================================================================
Install 1 Package
Total download size: 62 M
Installed size: 128 M
Is this ok [y/N]: y
Downloading Packages:
mongodb-org-tools-4.2.8-1.el8.x86_64.rpm 4.1 MB/s | 62 MB 00:15
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 4.0 MB/s | 62 MB 00:15
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mongodb-org-tools-4.2.8-1.el8.x86_64 1/1
Running scriptlet: mongodb-org-tools-4.2.8-1.el8.x86_64 1/1
Verifying : mongodb-org-tools-4.2.8-1.el8.x86_64 1/1
Installed:
mongodb-org-tools-4.2.8-1.el8.x86_64
Complete!
[lwk@qwfys:~]$
[lwk@qwfys:~]$ mongo -u lanzhou -p --host 192.168.3.88 --authenticationDatabase lanzhou
MongoDB shell version v4.2.8
Enter password:
connecting to: mongodb://192.168.3.88:27017/?authSource=lanzhou&compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("6eb0c76d-338a-46ff-aa5a-65f468b76875") }
MongoDB server version: 4.2.8
> db.artists.find().pretty()
{
"_id" : ObjectId("5f0fc3322d6c5971111129f4"),
"artistname" : "The Tea Party"
}
{ "_id" : ObjectId("5f0fc3882d6c5971111129f5"), "artistname" : "The Kooks" }
{ "_id" : ObjectId("5f0fc3882d6c5971111129f6"), "artistname" : "Bastille" }
{
"_id" : ObjectId("5f0fc3882d6c5971111129f7"),
"artistname" : "Gang of Four"
}
{
"_id" : ObjectId("5f0fc3b62d6c5971111129f8"),
"artistname" : "Deep Purple",
"albums" : [
{
"album" : "Machine Head",
"year" : 1972,
"genre" : "Rock"
},
{
"album" : "Stormbringer",
"year" : 1974,
"genre" : "Rock"
}
]
}
{
"_id" : ObjectId("5f0fc4032d6c5971111129f9"),
"artistname" : "Robben Ford",
"albums" : [
{
"album" : "Bringing it Back Home",
"year" : 2013,
"genre" : "Blues"
},
{
"album" : "Talk to Your Daughter",
"year" : 1988,
"genre" : "Blues"
}
]
}
{
"_id" : ObjectId("5f0fc4032d6c5971111129fa"),
"artistname" : "Snoop Dogg",
"albums" : [
{
"album" : "Tha Doggfather",
"year" : 1996,
"genre" : "Rap"
},
{
"album" : "Reincarnated",
"year" : 2013,
"genre" : "Reggae"
}
]
}
{
"_id" : 2,
"artistname" : "Prince",
"address" : {
"street" : "Audubon Road",
"city" : "Chanhassen",
"state" : "Minnesota",
"country" : "United States"
}
}
{
"_id" : 3,
"artistname" : "Moby",
"albums" : [
{
"album" : "Play",
"year" : 1999,
"genre" : "Electronica"
},
{
"album" : "Long Ambients 1: Calm. Sleep.",
"year" : 2016,
"genre" : "Ambient"
}
]
}
{ "_id" : 4, "artistname" : "Rush" }
>
mongoexport --db lanzhou -u lanzhou -p Gah6kuP7ohfio4 --host 192.168.3.88 --collection artists --type=csv --fields _id,artistname --out /home/lwk/Downloads/.tmp/artists.csv
--结束END--
本文标题: how to export cvs data from mongodb on centos7
本文链接: https://lsjlt.com/news/7268.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0