Hướng dẫn how do i export a mongodb database to another server? - làm cách nào để xuất cơ sở dữ liệu mongodb sang một máy chủ khác?

Tài liệu về nhà → Công cụ cơ sở dữ liệu MongoDBMongoDB Database Tools

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 là một công cụ dòng lệnh tạo ra xuất khẩu dữ liệu JSON hoặc CSV được lưu trữ trong một ví dụ MongoDB. is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.

Chạy

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 từ dòng lệnh hệ thống, không phải shell

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
from the system command line, not the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6
shell.

Mẹo

Xem thêm:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

7 cung cấp khả năng nhập dữ liệu có cấu trúc tương ứng.

Ghi chú

Nếu bạn đang lưu trữ dữ liệu cũ để tiết kiệm chi phí lưu trữ, hãy xem xét lưu trữ trực tuyến trong Atlas MongoDB. Lưu trữ trực tuyến tự động lưu trữ dữ liệu được truy cập không thường xuyên đến các thùng S3 được quản lý đầy đủ để phân loại dữ liệu hiệu quả về chi phí.Online Archive in MongoDB Atlas. Online Archive automatically archives infrequently accessed data to fully-managed S3 buckets for cost-effective data tiering.

Bắt đầu với MongoDB 4.4,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 hiện được phát hành tách biệt với máy chủ MongoDB và sử dụng phiên bản riêng của nó, với phiên bản ban đầu là

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

9. Trước đây,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 đã được phát hành cùng với máy chủ MongoDB và sử dụng phiên bản phù hợp.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
is now released separately from the MongoDB Server and uses its own versioning, with an initial version of

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

9. Previously,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
was released alongside the MongoDB Server and used matching versioning.

Đối với tài liệu trên MongoDB 4.2 hoặc các phiên bản trước đó của

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4, hãy tham khảo tài liệu máy chủ MongoDB cho phiên bản đó của công cụ:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
, reference the MongoDB Server Documentation for that version of the tool:

Ghi chú

Nếu bạn đang lưu trữ dữ liệu cũ để tiết kiệm chi phí lưu trữ, hãy xem xét lưu trữ trực tuyến trong Atlas MongoDB. Lưu trữ trực tuyến tự động lưu trữ dữ liệu được truy cập không thường xuyên đến các thùng S3 được quản lý đầy đủ để phân loại dữ liệu hiệu quả về chi phí.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4.

Bắt đầu với MongoDB 4.4,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 hiện được phát hành tách biệt với máy chủ MongoDB và sử dụng phiên bản riêng của nó, với phiên bản ban đầu là

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

9. Trước đây,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 đã được phát hành cùng với máy chủ MongoDB và sử dụng phiên bản phù hợp. version

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 supports the following versions of the MongoDB Server:

  • Đối với tài liệu trên MongoDB 4.2 hoặc các phiên bản trước đó của

    mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

    4, hãy tham khảo tài liệu máy chủ MongoDB cho phiên bản đó của công cụ:

  • Tài liệu này dành cho phiên bản

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

    2 của

    mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

    4.

  • mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

    4 Phiên bản

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

    2 hỗ trợ các phiên bản sau của máy chủ MongoDB:

  • MongoDB 6.0

MongoDB 5.0

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 may work on earlier versions of MongoDB server, any such compatibility is not guaranteed.

MongoDB 4.4 version

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 is supported on the following platforms:

x86_64

ARM64

PPC64LE

s390x

MongoDB 4.2

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau: / CentOS 8

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau: / CentOS 7

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau: / CentOS 6

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

Mặc dù

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 có thể hoạt động trên các phiên bản trước của máy chủ MongoDB, nhưng bất kỳ khả năng tương thích nào như vậy không được đảm bảo.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Phiên bản

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

2 được hỗ trợ trên các nền tảng sau:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
tool is part of the MongoDB Database Tools package:

Amazon 2

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 command has the following form:

mongoexport --collection=

Chạy

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 từ dòng lệnh hệ thống, không phải shell

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
from the system command line, not the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6
shell.

Amazon 2013.03+

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

4 to export. If you do not specify an

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

5
,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
writes to the standard output (e.g. stdout).

Debian 10

Debian 9

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

4 to the specified

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

5
from a local MongoDB instance running on port 27017:

mongoexport --collection=events --db=reporting --out=events.json

Debian 8

  • Rhel / Centos 8

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    Rhel / Centos 7

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9, the database can be specified as part of the string.

  • Rhel / Centos 6

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    1

    mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

  • SUSE 15

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    1 and

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    3

    mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

SUSE 12Options.

Ubuntu 20.04

  • Ubuntu 18.04

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName" --collection=events --out=events.json [additional options]

    Rhel / Centos 7

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9, the database can be specified as part of the string.

  • Rhel / Centos 6

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    1

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

SUSE 15

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 reads from the primary of the replica set. To override the default, you can specify the read preference:

  • SUSE 12

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    Ubuntu 20.04

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    9 option:

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    Rhel / Centos 7

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9, the database can be specified as part of the string.

  • Rhel / Centos 6

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    1 command-line option. The command-line option takes a string if specifying only the read preference mode:

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

    SUSE 15read preference tag sets, and the optional maxStalenessSeconds:

    mongoexport --collection=events --db=reporting --out=events.json

    0

SUSE 12Options.

Ubuntu 20.04

  • Ubuntu 18.04

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    3 instance in the

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9

    mongoexport --collection=events --db=reporting --out=events.json

    1

    Rhel / Centos 7

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9, the database can be specified as part of the string.

  • Rhel / Centos 6

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    3 instance in the

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    1

    mongoexport --collection=events --db=reporting --out=events.json

    2

SUSE 15

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 reads from the primary of the shard replica set. To override the default, you can specify the read preference:

  • SUSE 12

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9

    mongoexport --collection=events --db=reporting --out=events.json

    3

    Ubuntu 20.04

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    9 option:

    mongoexport --collection=events --db=reporting --out=events.json

    4

    Rhel / Centos 7

    mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

    9, the database can be specified as part of the string.

  • Rhel / Centos 6

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    1 command-line option. The command-line option takes a string if specifying only the read preference mode:

    mongoexport --collection=events --db=reporting --out=events.json

    5

    SUSE 15read preference tag sets, and the optional maxStalenessSeconds:

    mongoexport --collection=events --db=reporting --out=events.json

    6

Để biết thêm thông tin về các tùy chọn có sẵn, xem Tùy chọn.Options.

Mẹo

Xem thêm:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 yêu cầu truy cập đọc trên cơ sở dữ liệu đích. requires read access on the target database.

Đảm bảo rằng người dùng kết nối sở hữu, ở mức tối thiểu, vai trò

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

5 trên cơ sở dữ liệu đích.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

5
role on the target database.

Khi kết nối với

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6 hoặc

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3 thực thi xác thực, hãy đảm bảo bạn sử dụng các tham số bảo mật cần thiết dựa trên cơ chế xác thực được cấu hình.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6
or

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
that enforces Authentication, ensure you use the required security parameters based on the configured authentication mechanism.

Nếu bạn cần lưu giữ tất cả các loại dữ liệu BSON phong phú khi sử dụng

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 để thực hiện sao lưu phiên bản đầy đủ, hãy chắc chắn chỉ định JSON v2.0 (chế độ chính tắc) cho tùy chọn

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

9 thành

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4, theo kiểu sau:BSON data types when using

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
to perform full instance backups, be sure to specify Extended JSON v2.0 (Canonical mode) to the

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

9
option to

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
, in the following fashion:

mongoexport --collection=events --db=reporting --out=events.json

7

Nếu

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

9 không được xác định,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Dữ liệu đầu ra trong JSON v2.0 mở rộng (chế độ thư giãn) theo mặc định.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

9
is unspecified,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
outputs data in Extended JSON v2.0 (Relaxed mode) by default.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

7 sẽ tự động sử dụng định dạng JSON được tìm thấy trong tệp dữ liệu đích được chỉ định khi khôi phục. Ví dụ: nó sẽ sử dụng JSON v2.0 mở rộng (chế độ chính tắc) nếu tệp xuất dữ liệu đích được tạo bởi

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 với

mongoexport --collection=events --db=reporting --out=events.json

05 được chỉ định.JSON format found in the specified target data file when restoring. For example, it will use Extended JSON v2.0 (Canonical mode) if the target data export file was created by

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
with

mongoexport --collection=events --db=reporting --out=events.json

05 specified.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Tự động tạo các kết nối tuân thủ FIP thành

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3 được cấu hình để sử dụng chế độ FIP. automatically creates FIPS-compliant connections to a

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
that is configured to use FIPS mode.

Theo mặc định,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 sử dụng tùy chọn đọc

mongoexport --collection=events --db=reporting --out=events.json

10. Để ghi đè mặc định, bạn có thể chỉ định ưu tiên đọc trong tùy chọn dòng lệnh

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1 hoặc trong

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

9

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
uses read preference

mongoexport --collection=events --db=reporting --out=events.json

10
. To override the default, you can specify the read preference in the

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1
command line option or in the

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

9

Nếu bạn chỉ định đọc ưu tiên trong chuỗi URI và

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1, giá trị

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1 sẽ ghi đè lên sở thích đọc được chỉ định trong chuỗi URI.

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1
, the

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1
value overrides the read preference specified in the URI string.

Cảnh báo

Nhập dữ liệu và xuất xung đột với ($) và (.)

Bắt đầu từ MongoDB 5.0, tên trường tài liệu có thể là (

mongoexport --collection=events --db=reporting --out=events.json

15) có tiền tố và có thể chứa một (

mongoexport --collection=events --db=reporting --out=events.json

16). Tuy nhiên,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

7 và

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 không nên được sử dụng với các tên trường sử dụng các ký tự này.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
should not be used with field names that make use of these characters.

MongoDB mở rộng JSON V2 không thể phân biệt giữa các gói gói và trường xảy ra có cùng tên với trình bao bọc loại. Không sử dụng các định dạng JSON mở rộng trong các bối cảnh trong đó các biểu diễn BSON tương ứng có thể bao gồm (

mongoexport --collection=events --db=reporting --out=events.json

15) các khóa có tiền tố. Cơ chế DBREF là một ngoại lệ cho quy tắc chung này. cannot differentiate between type wrappers and fields that happen to have the same name as type wrappers. Do not use Extended JSON formats in contexts where the corresponding BSON representations might include (

mongoexport --collection=events --db=reporting --out=events.json

15) prefixed keys. The DBRef mechanism is an exception to this general rule.

Cũng có những hạn chế đối với việc sử dụng

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

7 và

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 với (

mongoexport --collection=events --db=reporting --out=events.json

16) trong tên trường. Vì các tệp CSV sử dụng (

mongoexport --collection=events --db=reporting --out=events.json

16) để biểu thị phân cấp dữ liệu, A (

mongoexport --collection=events --db=reporting --out=events.json

16) trong tên trường sẽ bị hiểu sai như một mức độ làm tổ.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
with (

mongoexport --collection=events --db=reporting --out=events.json

16) in field names. Since CSV files use the (

mongoexport --collection=events --db=reporting --out=events.json

16) to represent data hierarchies, a (

mongoexport --collection=events --db=reporting --out=events.json

16) in a field name will be misinterpreted as a level of nesting.

mongoexport --collection=events --db=reporting --out=events.json

25 returns thông tin về các tùy chọn và sử dụng

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
Hướng dẫn how do i export a mongodb database to another server? - làm cách nào để xuất cơ sở dữ liệu mongodb sang một máy chủ khác?

Returns information on the options and use of

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4

mongoexport --collection=events --db=reporting --out=events.json

27 tăng số lượng báo cáo nội bộ được trả lại cho đầu ra tiêu chuẩn hoặc trong các tệp nhật ký. Tăng độ merbosity với biểu mẫu

mongoexport --collection=events --db=reporting --out=events.json

28 bằng cách bao gồm tùy chọn nhiều lần, (ví dụ:

mongoexport --collection=events --db=reporting --out=events.json

29.)

Increases the amount of internal reporting returned on standard output or in log files. Increase the verbosity with the

mongoexport --collection=events --db=reporting --out=events.json

28 form by including the option multiple times, (e.g.

mongoexport --collection=events --db=reporting --out=events.json

29.)

mongoexport --collection=events --db=reporting --out=events.json

30Run

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Trong chế độ yên tĩnh cố gắng hạn chế lượng đầu ra.

Runs

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 in a quiet mode that attempts to limit the amount of output.

Tùy chọn này triệt tiêu:

  • đầu ra từ các lệnh cơ sở dữ liệudatabase commands

  • Hoạt động sao chép

  • kết nối các sự kiện được chấp nhận

  • Kết nối các sự kiện đóng

mongoexport --collection=events --db=reporting --out=events.json

32 returns Số phát hành

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4.

Returns the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 release number.

mongoexport --collection=events --db=reporting --out=events.json

34New trong phiên bản 100.3.0.

New in version 100.3.0.

Chỉ định đường dẫn đầy đủ đến tệp cấu hình YAML chứa các giá trị nhạy cảm cho các tùy chọn sau đến

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
:

  • mongoexport --collection=events --db=reporting --out=events.json

    36

  • mongoexport --collection=events --db=reporting --out=events.json

    37

  • mongoexport --collection=events --db=reporting --out=events.json

    38

Đây là cách được đề xuất để chỉ định mật khẩu thành

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4, ngoài việc chỉ định nó thông qua dấu nhắc mật khẩu.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
, aside from specifying it through a password prompt.

Tệp cấu hình có biểu mẫu sau:

mongoexport --collection=events --db=reporting --out=events.json

8

Chỉ định mật khẩu cho trường

mongoexport --collection=events --db=reporting --out=events.json

40 và cung cấp chuỗi kết nối trong trường

mongoexport --collection=events --db=reporting --out=events.json

41 có chứa mật khẩu mâu thuẫn sẽ dẫn đến lỗi.

Hãy chắc chắn để bảo mật tệp này với quyền hệ thống tập tin phù hợp.

Ghi chú

mongoexport --collection=events --db=reporting --out=events.json

42Specifying Chuỗi kết nối URI có thể giải quyết được của triển khai MongoDB, được đặt trong các trích dẫn:

Specifies the resolvable URI connection string of the MongoDB deployment, enclosed in quotes:

mongoexport --collection=events --db=reporting --out=events.json

9

Bắt đầu với phiên bản

mongoexport --collection=events --db=reporting --out=events.json

43 của

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4, chuỗi kết nối có thể được cung cấp thay thế dưới dạng tham số vị trí mà không cần sử dụng tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

37:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
, the connection string may alternatively be provided as a positional parameter, without using the

mongoexport --collection=events --db=reporting --out=events.json

37
option:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

0

Là một tham số vị trí, chuỗi kết nối có thể được chỉ định tại bất kỳ điểm nào trên dòng lệnh, miễn là nó bắt đầu với

mongoexport --collection=events --db=reporting --out=events.json

46 hoặc

mongoexport --collection=events --db=reporting --out=events.json

47. Ví dụ:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

1

Chỉ có thể cung cấp một chuỗi kết nối. Cố gắng bao gồm nhiều hơn một, cho dù sử dụng tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

37 hoặc làm đối số vị trí, sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

37
option or as a positional argument, will result in an error.

Để biết thông tin về các thành phần của chuỗi kết nối, hãy xem tài liệu định dạng URI chuỗi kết nối.Connection String URI Format documentation.

Ghi chú

mongoexport --collection=events --db=reporting --out=events.json

42Specifying Chuỗi kết nối URI có thể giải quyết được của triển khai MongoDB, được đặt trong các trích dẫn:

mongoexport --collection=events --db=reporting --out=events.json

49
may alternatively be specified using their own explicit command-line options, such as

mongoexport --collection=events --db=reporting --out=events.json

50
and

mongoexport --collection=events --db=reporting --out=events.json

36
. Providing a connection string while also using an explicit option and specifying conflicting information will result in an error.

Ghi chú

Cảnh báo

Nhập dữ liệu và xuất xung đột với ($) và (.)

mongoexport --collection=events --db=reporting --out=events.json

37 option may be visible to system status programs such as

mongoexport --collection=events --db=reporting --out=events.json

53 that may be invoked by other users. Consider instead:

  • bỏ qua mật khẩu trong chuỗi kết nối để nhận lời nhắc mật khẩu tương tác hoặc

  • Sử dụng tùy chọn

    mongoexport --collection=events --db=reporting --out=events.json

    54 để chỉ định tệp cấu hình chứa mật khẩu.

    mongoexport --collection=events --db=reporting --out=events.json

    54
    option to specify a configuration file containing the password.

mongoexport --collection=events --db=reporting --out=events.json

55Default: Localhost: 27017

Default: localhost:27017

Chỉ định tên máy chủ có thể giải quyết được của triển khai MongoDB. Theo mặc định,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 cố gắng kết nối với một thể hiện MongoDB đang chạy trên localhost trên số cổng

mongoexport --collection=events --db=reporting --out=events.json

57.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
attempts to connect to a MongoDB instance running on the localhost on port number

mongoexport --collection=events --db=reporting --out=events.json

57.

Để kết nối với một bộ bản sao, chỉ định

mongoexport --collection=events --db=reporting --out=events.json

58 và danh sách hạt giống của các thành viên đã đặt, như sau:

mongoexport --collection=events --db=reporting --out=events.json

58
and a seed list of set members, as in the following:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

2

Khi chỉ định định dạng danh sách SET bản sao,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 luôn kết nối với chính.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
always connects to the primary.

Bạn cũng có thể kết nối với bất kỳ thành viên nào của bản sao được đặt bằng cách chỉ định máy chủ và cổng chỉ của thành viên đó:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

3

Nếu bạn sử dụng IPv6 và sử dụng định dạng

mongoexport --collection=events --db=reporting --out=events.json

60, bạn phải gửi lại phần của địa chỉ và kết hợp cổng trong ngoặc (ví dụ:

mongoexport --collection=events --db=reporting --out=events.json

61).

Ngoài ra, bạn cũng có thể chỉ định tên máy chủ trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

1 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

1
and specifying conflicting information will result in an error.

mongoexport --collection=events --db=reporting --out=events.json

64Default: 27017

Default: 27017

Chỉ định cổng TCP mà phiên bản MongoDB lắng nghe các kết nối máy khách.

Ngoài ra, bạn cũng có thể chỉ định cổng trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

3 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

3
and specifying conflicting information will result in an error.

Kết nối

mongoexport --collection=events --db=reporting --out=events.json

67Enables với

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6 hoặc

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3 có hỗ trợ TLS/SSL được bật.

Enables connection to a

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6 or

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
that has TLS/SSL support enabled.

Ngoài ra, bạn cũng có thể định cấu hình hỗ trợ TLS/SSL trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

67 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

67
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --collection=events --db=reporting --out=events.json

72Spec chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 có chứa chuỗi chứng chỉ gốc từ cơ quan chứng chỉ. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Specifies the

mongoexport --collection=events --db=reporting --out=events.json

73 file that contains the root certificate chain from the Certificate Authority. Specify the file name of the

mongoexport --collection=events --db=reporting --out=events.json

73 file using relative or absolute paths.

Ngoài ra, bạn cũng có thể chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

75 trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

77 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

77
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --collection=events --db=reporting --out=events.json

72Spec chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 có chứa chuỗi chứng chỉ gốc từ cơ quan chứng chỉ. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Specifies the

mongoexport --collection=events --db=reporting --out=events.json

73 file that contains both the TLS/SSL certificate and key. Specify the file name of the

mongoexport --collection=events --db=reporting --out=events.json

73 file using relative or absolute paths.

Ngoài ra, bạn cũng có thể chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

75 trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

77 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

67
option to connect to a

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6
or

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
that has

mongoexport --collection=events --db=reporting --out=events.json

84
enabled without

mongoexport --collection=events --db=reporting --out=events.json

85

mongoexport --collection=events --db=reporting --out=events.json

78 Chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 chứa cả chứng chỉ và khóa TLS/SSL. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

88
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --collection=events --db=reporting --out=events.json

72Spec chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 có chứa chuỗi chứng chỉ gốc từ cơ quan chứng chỉ. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Specifies the password to de-crypt the certificate-key file (i.e.

mongoexport --collection=events --db=reporting --out=events.json

88). Use the

mongoexport --collection=events --db=reporting --out=events.json

38
option only if the certificate-key file is encrypted. In all cases, the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
will redact the password from all logging and reporting output.

Ngoài ra, bạn cũng có thể chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

75 trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

77 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

38
option, the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
will prompt for a passphrase. See TLS/SSL Certificate Passphrase.

mongoexport --collection=events --db=reporting --out=events.json

78 Chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 chứa cả chứng chỉ và khóa TLS/SSL. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

38
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --collection=events --db=reporting --out=events.json72Spec chỉ định tệp mongoexport --collection=events --db=reporting --out=events.json73 có chứa chuỗi chứng chỉ gốc từ cơ quan chứng chỉ. Chỉ định tên tệp của tệp mongoexport --collection=events --db=reporting --out=events.json73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Ngoài ra, bạn cũng có thể chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

75 trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

77 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

38
option may be visible to system status programs such as

mongoexport --collection=events --db=reporting --out=events.json

53 that may be invoked by other users. Consider using the

mongoexport --collection=events --db=reporting --out=events.json

54
option to specify a configuration file containing the password instead.

mongoexport --collection=events --db=reporting --out=events.json

78 Chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 chứa cả chứng chỉ và khóa TLS/SSL. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Specifies the

mongoexport --collection=events --db=reporting --out=events.json

73 file that contains the Certificate Revocation List. Specify the file name of the

mongoexport --collection=events --db=reporting --out=events.json

73 file using relative or absolute paths.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --collection=events --db=reporting --out=events.json

72Spec chỉ định tệp

mongoexport --collection=events --db=reporting --out=events.json

73 có chứa chuỗi chứng chỉ gốc từ cơ quan chứng chỉ. Chỉ định tên tệp của tệp

mongoexport --collection=events --db=reporting --out=events.json

73 bằng các đường dẫn tương đối hoặc tuyệt đối.

Bypasses the validation checks for server certificates and allows the use of invalid certificates. When using the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

04 setting, MongoDB logs as a warning the use of the invalid certificate.

Cảnh báo

Mặc dù có sẵn, tránh sử dụng tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

03 nếu có thể. Nếu việc sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

03 là cần thiết, chỉ sử dụng tùy chọn trên các hệ thống không thể xâm nhập.

Kết nối với ví dụ

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6 hoặc

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3 mà không xác thực chứng chỉ máy chủ là rủi ro bảo mật tiềm ẩn. Nếu bạn chỉ cần vô hiệu hóa việc xác thực tên máy chủ trong chứng chỉ TLS/SSL, xem

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6
or

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
instance without validating server certificates is a potential security risk. If you only need to disable the validation of the hostname in the TLS/SSL certificates, see

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09.

Ngoài ra, bạn cũng có thể vô hiệu hóa xác thực chứng chỉ trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

03 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

03
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09Disable Việc xác thực tên máy chủ trong chứng chỉ TLS/SSL. Cho phép

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 kết nối với các phiên bản MongoDB ngay cả khi tên máy chủ trong chứng chỉ của họ không khớp với tên máy chủ được chỉ định.

Disables the validation of the hostnames in TLS/SSL certificates. Allows

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 to connect to MongoDB instances even if the hostname in their certificates do not match the specified hostname.

Ngoài ra, bạn cũng có thể vô hiệu hóa xác thực tên máy chủ trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09
and specifying conflicting information will result in an error.

Để biết thêm thông tin về TLS/SSL và MongoDB, hãy xem Cấu hình MongoD và Mongo cho cấu hình TLS/SSL và TLS/SSL cho máy khách.Configure mongod and mongos for TLS/SSL and TLS/SSL Configuration for Clients.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09Disable Việc xác thực tên máy chủ trong chứng chỉ TLS/SSL. Cho phép

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 kết nối với các phiên bản MongoDB ngay cả khi tên máy chủ trong chứng chỉ của họ không khớp với tên máy chủ được chỉ định.

Specifies a username with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the

mongoexport --collection=events --db=reporting --out=events.json

36 and

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18
options.

Ngoài ra, bạn cũng có thể vô hiệu hóa xác thực tên máy chủ trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

09 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

50
and specifying conflicting information will result in an error.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

16 chỉ định tên người dùng để xác thực vào cơ sở dữ liệu MongoDB sử dụng xác thực. Sử dụng kết hợp với các tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

36 và

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18.MongoDB Atlas cluster using the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22
, you can specify your AWS access key ID in:

  • Ngoài ra, bạn cũng có thể chỉ định tên người dùng trực tiếp trong

    mongoexport --collection=events --db=reporting --out=events.json

    62. Cung cấp chuỗi kết nối đồng thời sử dụng

    mongoexport --collection=events --db=reporting --out=events.json

    50 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

  • Nếu kết nối với cụm Atlas MongoDB bằng cách sử dụng

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    21

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    22, bạn có thể chỉ định ID khóa truy cập AWS của mình trong:

    mongoexport --collection=events --db=reporting --out=events.json

    49
    , or

  • vùng này,

mongoexport --collection=events --db=reporting --out=events.json

49, hoặcConnect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each.

Biến môi trường

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

24.

Specifies a password with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the

mongoexport --collection=events --db=reporting --out=events.json

50 and

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18
options.

Xem Kết nối với cụm Atlas MongoDB bằng cách sử dụng thông tin xác thực AWS IAM để biết ví dụ về từng thông tin.

mongoexport --collection=events --db=reporting --out=events.json

50 option without

mongoexport --collection=events --db=reporting --out=events.json

36
or specify an empty string as the

mongoexport --collection=events --db=reporting --out=events.json

36
value, as in

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

31 .

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

25 chỉ định một mật khẩu để xác thực vào cơ sở dữ liệu MongoDB sử dụng xác thực. Sử dụng kết hợp với các tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

50 và

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --collection=events --db=reporting --out=events.json

36
and specifying conflicting information will result in an error.

Để nhắc người dùng về mật khẩu, hãy truyền tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

50 mà không cần

mongoexport --collection=events --db=reporting --out=events.json

36 hoặc chỉ định một chuỗi trống dưới dạng giá trị

mongoexport --collection=events --db=reporting --out=events.json

36, như trong

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

31.MongoDB Atlas cluster using the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22
, you can specify your AWS secret access key in:

  • Ngoài ra, bạn cũng có thể chỉ định tên người dùng trực tiếp trong

    mongoexport --collection=events --db=reporting --out=events.json

    62. Cung cấp chuỗi kết nối đồng thời sử dụng

    mongoexport --collection=events --db=reporting --out=events.json

    50 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

  • Nếu kết nối với cụm Atlas MongoDB bằng cách sử dụng

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    21

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    22, bạn có thể chỉ định ID khóa truy cập AWS của mình trong:

    mongoexport --collection=events --db=reporting --out=events.json

    49
    , or

  • vùng này,

mongoexport --collection=events --db=reporting --out=events.json

49, hoặcConnect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each.

Cảnh báo

Biến môi trường

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

24.

mongoexport --collection=events --db=reporting --out=events.json

36
option may be visible to system status programs such as

mongoexport --collection=events --db=reporting --out=events.json

53 that may be invoked by other users. Consider instead:

  • Xem Kết nối với cụm Atlas MongoDB bằng cách sử dụng thông tin xác thực AWS IAM để biết ví dụ về từng thông tin.

    mongoexport --collection=events --db=reporting --out=events.json

    36 option to receive an interactive password prompt, or

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    25 chỉ định một mật khẩu để xác thực vào cơ sở dữ liệu MongoDB sử dụng xác thực. Sử dụng kết hợp với các tùy chọn

    mongoexport --collection=events --db=reporting --out=events.json

    50 và

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    18.

    mongoexport --collection=events --db=reporting --out=events.json

    54
    option to specify a configuration file containing the password.

Để nhắc người dùng về mật khẩu, hãy truyền tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

50 mà không cần

mongoexport --collection=events --db=reporting --out=events.json

36 hoặc chỉ định một chuỗi trống dưới dạng giá trị

mongoexport --collection=events --db=reporting --out=events.json

36, như trong

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

31.

If connecting to a MongoDB Atlas cluster using the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22
, and using session tokens in addition to your AWS access key ID and secret access key, you can specify your AWS session token in:

  • Ngoài ra, bạn cũng có thể chỉ định tên người dùng trực tiếp trong

    mongoexport --collection=events --db=reporting --out=events.json

    62. Cung cấp chuỗi kết nối đồng thời sử dụng

    mongoexport --collection=events --db=reporting --out=events.json

    50 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.

  • Nếu kết nối với cụm Atlas MongoDB bằng cách sử dụng

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    21

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    22, bạn có thể chỉ định ID khóa truy cập AWS của mình trong:

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    46
    parameter to the

    mongoexport --collection=events --db=reporting --out=events.json

    49
    , or

  • vùng này,

mongoexport --collection=events --db=reporting --out=events.json

49, hoặcConnect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each.

Biến môi trường

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

24.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22

Xem Kết nối với cụm Atlas MongoDB bằng cách sử dụng thông tin xác thực AWS IAM để biết ví dụ về từng thông tin.

Specifies the authentication database where the specified

mongoexport --collection=events --db=reporting --out=events.json

50 has been created. See Authentication Database.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

25 chỉ định một mật khẩu để xác thực vào cơ sở dữ liệu MongoDB sử dụng xác thực. Sử dụng kết hợp với các tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

50 và

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
assumes that the database specified to export holds the user's credentials.

Để nhắc người dùng về mật khẩu, hãy truyền tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

50 mà không cần

mongoexport --collection=events --db=reporting --out=events.json

36 hoặc chỉ định một chuỗi trống dưới dạng giá trị

mongoexport --collection=events --db=reporting --out=events.json

36, như trong

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

31.GSSAPI (Kerberos), PLAIN (LDAP SASL), or

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

55
, you must set

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18
to

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

57.

Ngoài ra, bạn cũng có thể chỉ định mật khẩu trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --collection=events --db=reporting --out=events.json

36 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

18
and specifying conflicting information will result in an error.

Nếu kết nối với cụm Atlas MongoDB bằng cách sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22, bạn có thể chỉ định khóa truy cập bí mật AWS của mình trong:

Default: SCRAM-SHA-1

Biến môi trường

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

37.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
instance uses to authenticate to the

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6
or

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3

Trên một số hệ thống, mật khẩu được cung cấp trực tiếp bằng tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

36 có thể hiển thị cho các chương trình trạng thái hệ thống như

mongoexport --collection=events --db=reporting --out=events.json

53 có thể được gọi bởi những người dùng khác. Thay vào đó hãy xem xét:MongoDB Atlas ` cluster.

bỏ qua tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

36 để nhận lời nhắc mật khẩu tương tác hoặc

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

68
and specifying conflicting information will result in an error.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

69 Chỉ định tên của dịch vụ bằng GSSAPI/Kerberos. Chỉ yêu cầu nếu dịch vụ không sử dụng tên mặc định là

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

70.

Specify the name of the service using GSSAPI/Kerberos. Only required if the service does not use the default name of

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

70.

Tùy chọn này chỉ có sẵn trong MongoDB Enterprise.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

71 Chỉ định tên máy chủ của dịch vụ bằng GSSAPI/Kerberos. Chỉ yêu cầu nếu tên máy chủ của máy không khớp với tên máy chủ được giải quyết bằng DNS.

Specify the hostname of a service using GSSAPI/Kerberos. Only required if the hostname of a machine does not match the hostname resolved by DNS.

Tùy chọn này chỉ có sẵn trong MongoDB Enterprise.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

71 Chỉ định tên máy chủ của dịch vụ bằng GSSAPI/Kerberos. Chỉ yêu cầu nếu tên máy chủ của máy không khớp với tên máy chủ được giải quyết bằng DNS.

Specifies the name of the database on which to run the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

72Spec chỉ định tên của cơ sở dữ liệu để chạy

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4

mongoexport --collection=events --db=reporting --out=events.json

62
. Providing a connection string while also using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

75
and specifying conflicting information will result in an error.

Ngoài ra, bạn cũng có thể chỉ định cơ sở dữ liệu trực tiếp trong

mongoexport --collection=events --db=reporting --out=events.json

62. Cung cấp chuỗi kết nối đồng thời sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

75 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.

Specifies the collection to export.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

76 Chỉ định bộ sưu tập để xuất.

Specifies a field or fields to include in the export. Use a comma separated list of fields to specify multiple fields.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

77 Chỉ định một trường hoặc các trường để đưa vào xuất khẩu. Sử dụng danh sách các trường phân tách dấu phẩy để chỉ định nhiều trường.

Nếu bất kỳ tên trường nào của bạn bao gồm không gian trắng, hãy sử dụng dấu ngoặc kép để gửi danh sách trường. Ví dụ: nếu bạn muốn xuất hai trường,

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

78 và

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

79, bạn sẽ chỉ định

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

80.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81
output formats,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
includes only the specified field(s), and the specified field(s) can be a field within a sub-document.

Đối với các định dạng đầu ra

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 chỉ bao gồm (các) trường được chỉ định và (các) trường được chỉ định có thể là một trường trong một tài liệu phụ.JSON output formats,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
includes only the specified field(s) and the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

84 field, and if the specified field(s) is a field within a sub-document, the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
includes the sub-document with all its fields, not just the specified field within the document.

Đối với các định dạng đầu ra của JSON,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 chỉ bao gồm (các) trường được chỉ định và trường

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

84 và nếu (các) trường được chỉ định là một trường trong một tài liệu phụ,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 bao gồm cả tài liệu phụ với tất cả các trường của nó, không chỉ Trường được chỉ định trong tài liệu.Export Data in CSV Format using

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86 option
for sample usage.

Xem: Xuất dữ liệu ở định dạng CSV bằng cách sử dụng tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86 để sử dụng mẫu.

An alternative to

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86. The

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89
option allows you to specify in a file the field or fields to include in the export and is only valid with the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

90
option with value

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81. The file must have only one field per line, and the line(s) must end with the LF character (

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

92).

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

87an thay thế cho

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86. Tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89 cho phép bạn chỉ định trong tệp trường hoặc trường để đưa vào xuất và chỉ có giá trị với tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

90 với giá trị

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81. Tệp chỉ phải có một trường trên mỗi dòng và (các) dòng phải kết thúc bằng ký tự LF (

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

92). includes only the specified field(s). The specified field(s) can be a field within a sub-document.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 chỉ bao gồm (các) trường được chỉ định. (Các) trường được chỉ định có thể là một trường trong một tài liệu phụ.Use a File to Specify the Fields to Export in CSV Format for sample usage.

Xem Sử dụng tệp để chỉ định các trường để xuất ở định dạng CSV để sử dụng mẫu.

Provides a query as a JSON document (enclosed in quotes) to return matching documents in the export.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

94 cung cấp một truy vấn dưới dạng tài liệu JSON (kèm theo trích dẫn) để trả về các tài liệu phù hợp trong xuất khẩu.

Bạn phải gửi kèm theo tài liệu truy vấn trong các trích dẫn đơn (

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

95) để đảm bảo rằng nó không tương tác với môi trường vỏ của bạn.must be in Extended JSON v2 format (either relaxed or canonical/strict mode), including enclosing the field names and operators in quotes:

Truy vấn phải ở định dạng JSON V2 mở rộng (chế độ thư giãn hoặc chính tắc/nghiêm ngặt), bao gồm bao gồm các tên trường và toán tử trong trích dẫn:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

4

Ví dụ: được cung cấp một bộ sưu tập có tên

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

96 trong cơ sở dữ liệu

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

97 với các tài liệu sau:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
uses the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

99
option to export only the documents with the field

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

00 greater than or equal to (

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

01
) to

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

02 and the field

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

03 less than

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

04 (using the extended JSON v2 format (relaxed mode) for dates { "$date": "YYYY-MM-DDTHH:mm:ss.mmm"}):

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

5

Các

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 sau đây sử dụng tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

99 để chỉ xuất các tài liệu với trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

00 lớn hơn hoặc bằng (

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

01) sang

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

02 và trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

03 nhỏ hơn

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

04 (sử dụng định dạng JSON v2 mở rộng (chế độ thư giãn) ":" Yyyy-mm-ddthh: mm: ss.mmm "}):

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

6

Tệp kết quả chứa các tài liệu sau:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

05 option to

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4

Bạn có thể sắp xếp kết quả với tùy chọn

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

05 thành

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4

Default: json

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

07Default: JSONCSV format or

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

09 for JSON format.

Chỉ định loại tệp để xuất. Chỉ định

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81 cho định dạng CSV hoặc

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

09 cho định dạng JSON.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86
or the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89
option to declare the fields to export from the collection.

Nếu bạn chỉ định

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81, thì bạn cũng phải sử dụng tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

86 hoặc

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89 để khai báo các trường để xuất từ ​​bộ sưu tập.

Specifies a file to write the export to. If you do not specify a file name, the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 writes data to standard output (e.g.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

15).

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

13 chỉ định một tệp để viết xuất khẩu. Nếu bạn không chỉ định tên tệp,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 ghi dữ liệu vào đầu ra tiêu chuẩn (ví dụ:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

15).

Default: relaxed

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

16Default: Thư giãnMongoDB Extended JSON (v2) format.

Sửa đổi đầu ra để sử dụng chế độ kinh điển hoặc thư giãn của định dạng JSON (V2) của MongoDB.MongoDB Extended JSON (v2).

Để biết sự khác biệt giữa các chế độ kinh điển và thư giãn, xem MongoDB mở rộng JSON (V2).

Modifies the output of

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 to write the entire contents of the export as a single JSON array. By default

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
writes data using one JSON document for every MongoDB document.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

17 Điều chỉnh đầu ra của

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 để viết toàn bộ nội dung của xuất khẩu dưới dạng một mảng JSON duy nhất. Theo mặc định

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 ghi dữ liệu bằng một tài liệu JSON cho mỗi tài liệu MongoDB.

Outputs documents in a pretty-printed format JSON.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

20Outputs Tài liệu theo định dạng được in đẹp.

By default,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 includes the exported field names as the first line in a CSV output.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21
directs

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
to export the data without the list of field names.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21
is only valid with the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

90
option with value

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21BY Mặc định,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 bao gồm các tên trường được xuất dưới dạng dòng đầu tiên trong đầu ra CSV.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21 chỉ đạo

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 để xuất dữ liệu mà không có danh sách tên trường.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21 chỉ có giá trị với tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

90 với giá trị

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

81.Exclude Field Names from CSV Output for sample usage.

Xem loại trừ tên trường khỏi đầu ra CSV để sử dụng mẫu.

Default:

mongoexport --collection=events --db=reporting --out=events.json

10

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

28Default:

mongoexport --collection=events --db=reporting --out=events.json

10read preference for

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
. The

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1
option can take:

  • Chỉ định ưu tiên đọc cho

    mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

    4. Tùy chọn

    mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

    1 có thể lấy:

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    7

  • Một chuỗi nếu chỉ chỉ định chế độ ưu tiên đọc:read preference tag sets, and the optional maxStalenessSeconds:

    mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    8

    Nếu chỉ định MaxStalessionSeconds, giá trị phải lớn hơn hoặc bằng 90.maxStalenessSeconds, the value must be greater than or equal to 90.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Mặc định là ưu tiên

mongoexport --collection=events --db=reporting --out=events.json

10Read. defaults to

mongoexport --collection=events --db=reporting --out=events.json

10
read preference.

Nếu sở thích đọc cũng được bao gồm trong

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

9, dòng lệnh

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1 sẽ ghi đè ưu tiên đọc được chỉ định trong chuỗi URI.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com" --collection=events --db=reporting --out=events.json [additional options]

9
, the command-line

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

1
overrides the read preference specified in the URI string.

Cảnh báo

Sử dụng sở thích đọc khác với

mongoexport --collection=events --db=reporting --out=events.json

10 với kết nối với

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3 có thể tạo ra sự không nhất quán, trùng lặp hoặc dẫn đến các tài liệu bị bỏ lỡ.read preference other than

mongoexport --collection=events --db=reporting --out=events.json

10
with a connection to a

mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary&readPreferenceTags=region:east" --collection=events --out=events.json [additional options]

3
may produce inconsistencies, duplicates, or result in missed documents.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

38use

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

39 để kiểm soát nơi

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 bắt đầu xuất tài liệu. Xem

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

41 để biết thông tin về hoạt động cơ bản.

Use

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

39 to control where

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
begins exporting documents. See

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

41
for information about the underlying operation.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

42 chỉ định số lượng tài liệu tối đa để đưa vào xuất khẩu. Xem

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

43 để biết thông tin về hoạt động cơ bản.

Specifies a maximum number of documents to include in the export. See

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

43 for information about the underlying operation.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

44 chỉ định một đơn đặt hàng cho kết quả xuất khẩu. Nếu một chỉ mục không tồn tại có thể hỗ trợ hoạt động sắp xếp, kết quả phải nhỏ hơn 32 megabyte.

Specifies an ordering for exported results. If an index does not exist that can support the sort operation, the results must be less than 32 megabytes.

Sử dụng

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

05 Kết hợp với

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

39 và

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

47 để hạn chế số lượng tài liệu xuất.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

05
conjunction with

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

39
and

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

47
to limit number of exported documents.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

9

Xem

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

48 để biết thông tin về hoạt động cơ bản.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

48
for information about the underlying operation.

Chạy

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 từ dòng lệnh hệ thống, không phải shell

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
from the system command line, not the

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

6
shell.

Trong ví dụ sau,

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 xuất dữ liệu từ bộ sưu tập

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 trong cơ sở dữ liệu

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

53 ở định dạng CSV sang tệp

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

54.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
exports data from the collection

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 collection in the

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

53 database in CSV format to the file

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

54.

Ví dụ

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6 mà

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 kết nối với việc chạy trên số cổng localhost

mongoexport --collection=events --db=reporting --out=events.json

57.

mongoexport --host="myReplicaSetName/mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017" --readPreference=secondary --collection=events --db=reporting --out=events.json [additional options]

6
instance that

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
connects to is running on the localhost port number

mongoexport --collection=events --db=reporting --out=events.json

57.

Khi bạn xuất ở định dạng CSV, bạn phải chỉ định các trường trong các tài liệu để xuất. Hoạt động chỉ định các trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

58 và

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

59 để xuất.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

0

Đầu ra sau đó sẽ giống với:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

1

Chỉ để xuất CSV, bạn cũng có thể chỉ định các trường trong một tệp chứa danh sách các trường được phân tách dòng để xuất. Tệp phải chỉ có một trường trên mỗi dòng.

Ví dụ: bạn có thể chỉ định các trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

58 và

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

59 trong tệp

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

62:

Sau đó, sử dụng tùy chọn

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89, chỉ định các trường để xuất với tệp:

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

89
option, specify the fields to export with the file:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

2

Tùy chọn

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21 có thể được sử dụng để loại trừ tên trường trong xuất CSV. Ví dụ sau xuất xuất các trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

58 và

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

59 trong bộ sưu tập

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 trong cơ sở dữ liệu

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

53 và sử dụng

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21 để triệt tiêu đầu ra của tên trường làm dòng đầu tiên:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21
option can be used to exclude field names in a CSV export. The following example exports the

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

58 and

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

59 fields in the

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 collection in the

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

53 database and uses

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

21
to suppress the output of the field names as the first line:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

3

Đầu ra CSV sau đó sẽ giống với:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

4

Ví dụ này tạo ra xuất khẩu bộ sưu tập

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 từ phiên bản MongoDB chạy trên số cổng localhost

mongoexport --collection=events --db=reporting --out=events.json

57. Điều này viết xuất xuất vào tệp

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

72 ở định dạng JSON.JSON format.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

5

Ví dụ sau xuất khẩu bộ sưu tập

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 trong cơ sở dữ liệu

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

74 từ một ví dụ MongoDB từ xa yêu cầu xác thực.

Chỉ định la:

  • mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    1

  • mongoexport --uri="mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/reporting?replicaSet=myReplicaSetName&readPreference=secondary" --collection=events --out=events.json [additional options]

    3

  • mongoexport --collection=events --db=reporting --out=events.json

    50

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    18

  • mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

    79

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    75

  • mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

    81

Mẹo

Bỏ qua tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

36 để có lời nhắc

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 cho mật khẩu:

mongoexport --collection=events --db=reporting --out=events.json

36
option to have

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 prompt for the password:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

6

Ngoài ra, bạn sử dụng tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

37 để chỉ định máy chủ, cổng, tên người dùng, cơ sở dữ liệu xác thực và DB.

mongoexport --collection=events --db=reporting --out=events.json

37
option to specify the host, port, username, authentication database, and db.

Mẹo

Bỏ qua tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

36 để có lời nhắc

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 cho mật khẩu:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

7

Ngoài ra, bạn sử dụng tùy chọn

mongoexport --collection=events --db=reporting --out=events.json

37 để chỉ định máy chủ, cổng, tên người dùng, cơ sở dữ liệu xác thực và DB.

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

86
option, and limit the results to a single database using the "

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

75
" option.

Bỏ qua mật khẩu trong chuỗi URI để có lời nhắc

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 cho mật khẩu:canonical format for dates { "$date": "YYYY-MM-DDTHH:mm:ss.mmm"} )

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

8

Bạn chỉ có thể xuất kết quả của truy vấn bằng cách cung cấp bộ lọc truy vấn với tùy chọn

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

86 và giới hạn kết quả ở một cơ sở dữ liệu bằng tùy chọn "

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

75".

Chẳng hạn, lệnh này trả về tất cả các tài liệu trong bộ sưu tập

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

52 của cơ sở dữ liệu

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

88 có chứa một trường có tên

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

90 bằng

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

91 và trường

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

03 lớn hơn hoặc bằng isodate ("2018-01-01") "$ ngày": "Yyyy-mm-ddthh: mm: ss.mmm"}))

Bạn phải gửi kèm theo tài liệu truy vấn trong các trích dẫn đơn (

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

95) để đảm bảo rằng nó không tương tác với môi trường vỏ của bạn.MongoDB Atlas cluster which has been configured to support authentication via AWS IAM credentials, provide a

mongoexport --collection=events --db=reporting --out=events.json

49
to

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
similar to the following:

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

9

Mới trong phiên bản 100.1.0.

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22 and the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

57

mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]

99
, as shown in this example.

Để kết nối với cụm Atlas MongoDB đã được cấu hình để hỗ trợ xác thực thông qua thông tin xác thực AWS IAM, cung cấp

mongoexport --collection=events --db=reporting --out=events.json

49 đến

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 tương tự như sau:AWS session token, as well, provide it with the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

45

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

46
value, as follows:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

0

Kết nối với Atlas bằng thông tin AWS IAM theo cách này sử dụng mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]21 mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]22 và mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]57 mongoexport --host="mongodb0.example.com:27017" --collection=events --db=reporting --out=events.json [additional options]99, như trong ví dụ này.

Nếu cũng sử dụng mã thông báo phiên AWS, hãy cung cấp cho giá trị

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

45

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

46, như sau:

Ghi chúpercent encoding.

Nếu ID khóa truy cập AWS, khóa truy cập bí mật hoặc mã thông báo phiên bao gồm các ký tự sau:

mongoexport --collection=events --db=reporting --out=events.json

50,

mongoexport --collection=events --db=reporting --out=events.json

36
, and

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

04
options instead, like so:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

1

Khi được cung cấp dưới dạng tham số dòng lệnh, ba tùy chọn này không yêu cầu mã hóa phần trăm.

Bạn cũng có thể đặt các thông tin này trên nền tảng của mình bằng các biến môi trường AWS IAM tiêu chuẩn.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4 Kiểm tra các biến môi trường sau khi bạn sử dụng

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22AWS IAM environment variables.

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

4
checks for the following environment variables when you use the

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

21

mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

22

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    24

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    37

  • mongoexport --uri="mongodb://mongodb0.example.com:27017/reporting" --collection=events --out=events.json [additional options]

    45

Nếu được đặt, các thông tin đăng nhập này không cần được chỉ định trong chuỗi kết nối hoặc thông qua các tùy chọn rõ ràng của chúng.

Ghi chú

Nếu bạn chọn sử dụng các biến môi trường AWS để chỉ định các giá trị này, bạn không thể trộn và kết hợp với các tùy chọn chuỗi kết nối hoặc rõ ràng tương ứng cho các thông tin này. Sử dụng các biến môi trường cho khóa truy cập ID và khóa truy cập bí mật (và mã thông báo phiên nếu được sử dụng) hoặc chỉ định từng loại này bằng cách sử dụng các tùy chọn chuỗi kết nối hoặc rõ ràng.or specify each of these using the explicit or connection string options instead.

Ví dụ sau đây đặt các biến môi trường này trong shell

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

11:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

2

Cú pháp để thiết lập các biến môi trường trong các vỏ khác sẽ khác nhau. Tham khảo tài liệu cho nền tảng của bạn để biết thêm thông tin.

Bạn có thể xác minh rằng các biến môi trường này đã được đặt với lệnh sau:

Sau khi được đặt, ví dụ sau kết nối với cụm Atlas MongoDB bằng cách sử dụng các biến môi trường này:

mongoexport --host="mongodb0.example.com" --port=27017 --collection=events --db=reporting --out=events.json [additional options]

3

Làm cách nào để xuất toàn bộ cơ sở dữ liệu MongoDB?

Vì vậy, để xuất dữ liệu từ cơ sở dữ liệu MongoDB, MongoDB cung cấp một công cụ dòng lệnh được gọi là MongoExport. Sử dụng công cụ này, bạn có thể xuất dữ liệu của một bộ sưu tập trong định dạng JSON hoặc CSV (giá trị phân tách bằng dấu phẩy). Hơn nữa, chúng tôi cũng có thể sử dụng các tính năng như giới hạn và sắp xếp trên một bộ sưu tập trong khi xuất dữ liệu.MongoDB provides a command-line tool known as mongoexport. Using this tool you can exports data of a collection in JSON or CSV(comma-separated value) format. Moreover, we can also use features like limit and sort on a collection while exporting the data.

Làm cách nào để xuất và nhập cơ sở dữ liệu MongoDB?

Procedure..
Kết nối với triển khai có chứa bộ sưu tập bạn muốn nhập dữ liệu vào.....
Điều hướng đến bộ sưu tập mục tiêu của bạn.....
Nhấp vào Thêm thả xuống dữ liệu và chọn Nhập tệp.....
Chọn vị trí của tệp dữ liệu nguồn trong tệp chọn ..
Chọn loại tệp thích hợp.....
Định cấu hình các tùy chọn nhập.....
Nhấp vào nhập ..

Làm cách nào để sao chép cơ sở dữ liệu MongoDB?

Sao chép/sao chép cơ sở dữ liệu trong MongoDB..
Sử dụng lệnh db.collection.copyto () để sao chép/sao chép cơ sở dữ liệu trong MongoDB ..
Sử dụng lệnh db.collection.find ().
Sử dụng các công cụ MongoDump và MongoRestore để sao chép/sao chép cơ sở dữ liệu trong MongoDB ..

Xuất khẩu trong MongoDB là gì?

Tóm tắt.MongoExport là một công cụ dòng lệnh tạo ra xuất khẩu dữ liệu JSON hoặc CSV được lưu trữ trong một ví dụ MongoDB.Chạy MongoExport từ dòng lệnh hệ thống, không phải vỏ Mongo.a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance. Run mongoexport from the system command line, not the mongo shell.