Hướng dẫn how to import database mongodb - cách nhập cơ sở dữ liệu mongodb
Tài liệu về nhà → Công cụ cơ sở dữ liệu MongoDB → MongoDB Database Tools Show
Công cụ 7 nhập nội dung từ xuất khẩu JSON, CSV hoặc TSV mở rộng được tạo bởi 8 hoặc có khả năng, một công cụ xuất khẩu của bên thứ ba khác. 7 tool imports content from an
Extended JSON, CSV, or TSV export created by 8, or potentially, another third-party export tool.Chạy 7 từ dòng lệnh hệ thống, không phải shell 0. 7 from the system command line, not the 0 shell.MẹoXem thêm: 8 cung cấp khả năng xuất dữ liệu có cấu trúc tương ứng.Bắt đầu với MongoDB 4.4, 7 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à 3. Trước đây, 7 đã được phát hành cùng với máy chủ MongoDB và sử dụng phiên bản phù hợp. 7 is now released separately from the MongoDB Server and uses its own versioning, with an initial version of
3. Previously, 7 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 7, hãy tham khảo tài liệu máy chủ MongoDB cho phiên bản đó của công cụ: 7, reference the
MongoDB Server Documentation for that version of the tool:Ghi chúTài liệu này dành cho phiên bản 6 của 7. 7.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] 6 supports the following versions of the MongoDB Server:
Mặc dù 7 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. 7 may work on earlier
versions of MongoDB server, any such compatibility is not guaranteed.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] 6 is supported on the following platforms:
Amazon 2013.03+ --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Debian 10 --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Debian 9 --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
Chạy 7 từ dòng lệnh hệ thống, không phải shell 0. 7 from the system command line, not the 0 shell.Debian 8BSON data types when using 8 to perform full instance backups, be sure to specify Extended JSON v2.0
(Canonical mode) to the 9 option to 8, in the following fashion:
Rhel / Centos 8Extended JSON v2.0 (Relaxed mode) by default. Rhel / Centos 7 will automatically use the 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 8 with 5 specified.Rhel / Centos 6 requires import data to be in either Extended JSON v2.0
(Canonical) or Extended JSON v2.0 (Relaxed) format by default. For import data formatted using Extended JSON v1.0, specify the --host= MẹoSUSE 15 only supports data files that are UTF-8 encoded. Using other encodings will produce errors. SUSE 12 automatically creates FIPS-compliant connections to a
--host= --host= Ubuntu 20.04 --host= --host= --host= Ubuntu 18.04 uses a maximum batch size of 100,000 to perform bulk insert/upsert operations. Ubuntu 16.04 --host= --host= --host= --host= Ubuntu 14.04Windows 8 trở lênWindows Server 2012 trở lên --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 8 should not be used with field names that make use of these characters.MacOS 10.12 trở lên 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 ( 1) prefixed keys. The DBRef mechanism is an exception to this
general rule.Công cụ 7 là một phần của gói công cụ cơ sở dữ liệu MongoDB: 7 and 8 with ( 2) in field names. Since CSV files use the ( 2) to represent data hierarchies, a ( 2) in a field name will be misinterpreted as a level of
nesting. 7.Returns information on the options and use of --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 7 có biểu mẫu sau:Increases the amount of internal reporting returned on standard output or in log files. Increase the verbosity with the 4 form by including the option multiple times, (e.g. 5.)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 8 để 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 9 thành 8, theo kiểu sau:Runs --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Nếu 9 không được xác định, 8 Dữ liệu xuất ra trong JSON v2.0 (chế độ thư giãn) theo mặc định) theo mặc định.
2 và tùy chọn 3, giá trị 2 sẽ ghi đè lên mối quan tâm ghi được chỉ định trong chuỗi URI.Returns the --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 00New 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 7: 7:
Đây là cách được đề xuất để chỉ định mật khẩu thành 7, ngoài việc chỉ định nó thông qua dấu nhắc mật khẩu. 7, aside from specifying it through a password prompt.Tệp cấu hình có biểu mẫu sau:
Chỉ định mật khẩu cho trường 06 và cung cấp chuỗi kết nối trong trường 07 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ú 08Specifying Chuỗi kết nối URI có thể giải quyết được của triển khai MongoDB, kèm theo trích dẫn:Specifies the resolvable URI connection string of the MongoDB deployment, enclosed in quotes:
Bắt đầu với phiên bản 09 của 7, 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 03: 7, the connection string may alternatively be provided as a positional parameter, without using the 03 option:
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 12 hoặc 13. Ví dụ:
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 03 hoặc làm đối số vị trí, sẽ dẫn đến lỗi. 03 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ú 08Specifying Chuỗi kết nối URI có thể giải quyết được của triển khai MongoDB, kèm theo trích dẫn: 15 may alternatively be specified using their own explicit command-line options, such as
8 and 9. Providing a connection string while also using an explicit option and specifying conflicting information will result in an error.Ghi chúmongoexport --jsonFormat=canonical --collection=Bắt đầu với phiên bản 09 của 7, 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 03: 03 option may be visible to system status programs such as 19 that may be invoked by other users. Consider instead:
Default: localhost:27017 Một số thành phần trong 15 có thể được chỉ định bằng cách sử dụng các tùy chọn dòng lệnh rõ ràng của riêng họ, chẳng hạn như 8 và 9. Cung cấp một chuỗi kết nối đồng thời sử dụng tùy chọn rõ ràng và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi. 7 attempts to connect to a MongoDB instance running on the localhost on port number 23.Cảnh báo mongoexport --jsonFormat=canonical --collection=
Trên một số hệ thống, một mật khẩu được cung cấp trong chuỗi kết nối với tùy chọn ____103 có thể hiển thị cho các chương trình trạng thái hệ thống như 19 có thể được gọi bởi những người dùng khác. Thay vào đó hãy xem xét: 7 always connects to the
primary.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 20 để chỉ định tệp cấu hình chứa mật khẩu. 21Default: Localhost: 27017 28. Providing a connection string while also using 29 and specifying conflicting information will result in an error.Chỉ định tên máy chủ có thể giải quyết được của triển khai MongoDB. Theo mặc định, 7 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 23.Default: 27017 Để kết nối với một bộ bản sao, chỉ định 24 và danh sách hạt giống của các thành viên đã đặt, như sau:Khi chỉ định định dạng danh sách SET bản sao, 7 luôn kết nối với chính. 28. Providing a connection string while also using 32 and specifying conflicting information will result in an error.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 đó:Enables connection to a --host= --host= Nếu bạn sử dụng IPv6 và sử dụng định dạng 26, 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ụ: 27). 28. Providing a connection string while also using
33 and specifying conflicting information will result in an error.Ngoài ra, bạn cũng có thể chỉ định tên máy chủ trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 29 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.Configure mongod and mongos for TLS/SSL and
TLS/SSL Configuration for Clients. 30Default: 27017Specifies the 39 file that contains the root
certificate chain from the Certificate Authority. Specify the file name of the 39 file using relative or absolute paths.Chỉ định cổng TCP mà phiên bản MongoDB lắng nghe các kết nối máy khách. mongoexport --jsonFormat=canonical --collection= mongoexport --jsonFormat=canonical --collection= Ngoài ra, bạn cũng có thể chỉ định tên máy chủ trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 29 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.Configure mongod and mongos for TLS/SSL and
TLS/SSL Configuration for Clients. 30Default: 27017Specifies the 39 file that contains both the
TLS/SSL certificate and key. Specify the file name of the 39 file using relative or absolute paths.Chỉ định cổng TCP mà phiên bản MongoDB lắng nghe các kết nối máy khách. mongoexport --jsonFormat=canonical --collection= --host= --host= mongoexport --jsonFormat=canonical --collection= mongoexport --jsonFormat=canonical --collection= Ngoài ra, bạn cũng có thể chỉ định cổng trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 32 và chỉ định thông tin xung đột sẽ dẫn đến lỗi. 28. Providing a connection string while also using
54 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. 55 chỉ định mật khẩu để hủy bỏ tệp khóa chứng chỉ (tức là 54). Chỉ sử dụng tùy chọn 04 nếu tệp khóa chứng chỉ được mã hóa. Trong mọi trường hợp, 7 sẽ điều chỉnh lại mật khẩu từ tất cả các đầu ra ghi nhật ký và báo cáo.Specifies the password to de-crypt the
certificate-key file (i.e. mongoexport --jsonFormat=canonical --collection= mongoexport --jsonFormat=canonical --collection= --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Nếu khóa riêng trong tệp PEM được mã hóa và bạn không chỉ định tùy chọn 04, 7 sẽ nhắc cho một cụm từ. Xem Cụm mật khẩu Chứng chỉ TLS/SSL. 04 option, the 7 will prompt for
a passphrase. See TLS/SSL Certificate Passphrase.Ngoài ra, bạn cũng có thể chỉ định mật khẩu trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 04 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi. 28. Providing a connection string while also using
04 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. Cảnh báoTrê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 04 có thể hiển thị cho các chương trình trạng thái hệ thống như 19 có thể được gọi bởi những người dùng khác. Xem xét sử dụng tùy chọn 20 để chỉ định tệp cấu hình có chứa mật khẩu thay thế. 04 option may be visible to system status programs such as
19 that may be invoked by other users. Consider using the 20 option to specify a configuration file containing the password instead. 66 Chỉ định tệp 39 chứa danh sách thu hồi chứng chỉ. Chỉ định tên tệp của tệp 39 bằng các đường dẫn tương đối hoặc tuyệt đối.Specifies the 39 file that contains the Certificate Revocation List. Specify the file name of the 39 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. 69Bypasses Kiểm tra xác thực cho chứng chỉ máy chủ và cho phép sử dụng các chứng chỉ không hợp lệ. Khi sử dụng cài đặt 70, MongoDB ghi nhật ký như một cảnh báo về việc sử dụng chứng chỉ không hợp lệ.Bypasses the validation checks for server certificates and allows the use of invalid certificates. When using the mongoexport --jsonFormat=canonical --collection= Cảnh báoTrê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 04 có thể hiển thị cho các chương trình trạng thái hệ thống như 19 có thể được gọi bởi những người dùng khác. Xem xét sử dụng tùy chọn 20 để chỉ định tệp cấu hình có chứa mật khẩu thay thế. 66 Chỉ định tệp 39 chứa danh sách thu hồi chứng chỉ. Chỉ định tên tệp của tệp 39 bằng các đường dẫn tương đối hoặc tuyệt đối. 0 or 1 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 75. 69Bypasses Kiểm tra xác thực cho chứng chỉ máy chủ và cho phép sử dụng các chứng chỉ không hợp lệ. Khi sử dụng cài đặt 70, MongoDB ghi nhật ký như một cảnh báo về việc sử dụng chứng chỉ không hợp lệ. 28. Providing a connection string while also using 69 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. Mặc dù có sẵn, tránh sử dụng tùy chọn 69 nếu có thể. Nếu việc sử dụng 69 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.Disables the validation of the hostnames in TLS/SSL certificates. Allows --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Kết nối với phiên bản 0 hoặc 1 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, hãy xem 75. 28. Providing a connection string while also using 75 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. 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 28. Cung cấp chuỗi kết nối đồng thời sử dụng 69 và chỉ định thông tin mâu thuẫn sẽ dẫn đến lỗi.Specifies a username with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the
--host= mongoexport --jsonFormat=canonical --collection= 75Disable Việc xác thực tên máy chủ trong chứng chỉ TLS/SSL. Cho phép 7 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. 28. Providing a connection string while also using 8 and specifying conflicting information will result in an error.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 28. Cung cấp chuỗi kết nối đồng thời sử dụng 75 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.MongoDB Atlas cluster using the 87 88, you can specify your AWS access key ID in:
vùng này,Connect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each. 15 hoặcSpecifies a password with which to authenticate to a MongoDB database that uses authentication. Use in conjunction with the
--host= mongoexport --jsonFormat=canonical --collection= Biến môi trường 90. 8 option without 9 or specify an empty string as the 9 value, as in 97
.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 --jsonFormat=canonical --collection= --host= 91 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 8 và 84.MongoDB Atlas cluster using the 87 88, you can specify your AWS secret access key in:
vùng này,Connect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each. Cảnh báoTrê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 04 có thể hiển thị cho các chương trình trạng thái hệ thống như 19 có thể được gọi bởi những người dùng khác. Xem xét sử dụng tùy chọn 20 để chỉ định tệp cấu hình có chứa mật khẩu thay thế. 9 option may be visible to system status programs such as 19 that may be invoked by other users. Consider instead:
08if Kết nối với cụm Atlas MongoDB bằng cách sử dụng 87 88 và sử dụng mã thông báo phiên ngoài ID khóa truy cập AWS và khóa truy cập bí mật của bạn, bạn có thể chỉ định mã thông báo AWS phiên của mình trong:If connecting to a MongoDB Atlas cluster using the 87 88, and using session tokens in addition to your AWS access key ID and secret
access key, you can specify your AWS session token in:
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.Connect to a MongoDB Atlas Cluster using AWS IAM Credentials for an example of each. Chỉ hợp lệ khi sử dụng 87 88 88 17 chỉ định cơ sở dữ liệu xác thực trong đó 8 được chỉ định đã được tạo. Xem cơ sở dữ liệu xác thực.Specifies the authentication database where the specified --host= Nếu sử dụng GSSAPI (Kerberos), Plain (LDAP SASL) hoặc 87 20, bạn phải đặt 84 thành 22.GSSAPI (Kerberos), PLAIN (LDAP SASL), or 87 20, you must set 84 to 22.Ngoài ra, bạn cũng có thể chỉ định cơ sở dữ liệu xác thực trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 84 và chỉ định thông tin xung đột sẽ dẫn đến lỗi. 28. Providing a connection string while also using 84 and specifying conflicting information will result in an error. 25Default: Scram-sha-1Default: SCRAM-SHA-1 Chỉ định cơ chế xác thực, ví dụ 7 sử dụng để xác thực với 0 hoặc 1 7 instance uses to authenticate to
the 0 or 1Đã thay đổi trong phiên bản 100.1.0: Bắt đầu từ phiên bản 29, 7 thêm hỗ trợ cho cơ chế xác thực 87 khi kết nối với cụm Atlas MongoDB.MongoDB Atlas cluster.Ngoài ra, bạn cũng có thể chỉ định cơ chế xác thực trực tiếp trong 28. Cung cấp chuỗi kết nối đồng thời sử dụng 33 và chỉ định thông tin xung đột sẽ dẫn đến lỗi. 28. Providing a connection string while also using 33 and specifying conflicting information will result in an error. 34 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à 35.Specify the name of the service using GSSAPI/Kerberos. Only required if the service does not use the default name of 35.Tùy chọn này chỉ có sẵn trong MongoDB Enterprise. 36 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. 36 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
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 37 Chỉ định tên của cơ sở dữ liệu để chạy 7 28. Providing a connection string while also using
40 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 28. Cung cấp chuỗi kết nối đồng thời sử dụng 40 và chỉ định thông tin xung đột sẽ dẫn đến lỗi.Specifies the collection to
import. If you do not specify --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 41 chỉ định bộ sưu tập để nhập. Nếu bạn không chỉ định 42, 7 lấy tên thu thập từ tên tệp đầu vào, hãy bỏ qua phần mở rộng của tệp nếu nó có.Specify a comma separated list of field names when importing CSV or TSV files that do not have field names in the first (i.e. header) line of the file. 44 Chỉ định danh sách các tên trường được phân tách bằng dấu phẩy khi nhập các tệp CSV hoặc TSV không có tên trường trong dòng đầu tiên (tức là tiêu đề) của tệp. 45 with
46Để chỉ định loại trường cũng như tên trường, hãy sử dụng 45 với 46 45 when importing JSON data, 7 will return an
error. 45 is only for CSV or TSV imports.Nếu bạn cố gắng bao gồm 45 khi nhập dữ liệu JSON, 7 sẽ trả về lỗi. 45 chỉ dành cho nhập khẩu CSV hoặc TSV.As an alternative to 50as Một giải pháp thay thế cho 45, tùy chọn 52 cho phép bạn chỉ định một tệp chứa danh sách tên trường nếu tệp CSV hoặc TSV của bạn không bao gồm tên trường trong dòng đầu tiên của tệp (tức là tiêu đề). Đặt một trường trên mỗi dòng. 52 with
46Để chỉ định loại trường cũng như tên trường, hãy sử dụng 52 với 46 52 when importing JSON data, 7 will return an
error. 52 is only for CSV or TSV imports.Nếu bạn cố gắng bao gồm 52 khi nhập dữ liệu JSON, 7 sẽ trả về lỗi. 52 chỉ dành cho nhập khẩu CSV hoặc TSV.Ignores empty fields in CSV and
TSV exports. If not specified, --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 58ignores các trường trống trong xuất khẩu CSV và TSV. Nếu không được chỉ định, 7 tạo các trường không có giá trị trong các tài liệu đã nhập. 58 when importing JSON data, 7 will return an error. 58 is only for
CSV or TSV imports.Nếu bạn cố gắng bao gồm 58 khi nhập dữ liệu JSON, 7 sẽ trả về lỗi. 58 chỉ dành cho nhập khẩu CSV hoặc TSV.Specifies the file type to import. The default format is JSON, but it's possible to import CSV and TSV files. 63 Chỉ định loại tệp để nhập. Định dạng mặc định là JSON, nhưng có thể nhập các tệp CSV và TSV.RFC-4180. As a result, backslashes
are not a valid escape character. If you use double-quotes to enclose fields in the CSV data, you must escape internal double-quote marks by prepending another double-quote.Trình phân tích cú pháp 64 chấp nhận dữ liệu đó tuân thủ RFC RFC-4180. Kết quả là, dấu gạch chéo ngược không phải là một nhân vật thoát hợp lệ. Nếu bạn sử dụng các trình điều khiển kép để gửi các trường trong dữ liệu CSV, bạn phải thoát các điểm trích dẫn kép bên trong bằng cách chi tiêu một trình duyệt kép khác.Specifies the location and name of a file
containing the data to import. If you do not specify a file, --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 65 chỉ định vị trí và tên của một tệp chứa dữ liệu để nhập. Nếu bạn không chỉ định một tệp, 7 sẽ đọc dữ liệu từ đầu vào tiêu chuẩn (ví dụ: "stdin").Modifies the import process so that the target instance drops the collection before importing the data from the input. 67 Điều chỉnh quy trình nhập để phiên bản đích giảm bộ sưu tập trước khi nhập dữ liệu từ đầu vào.If using --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 68if Sử dụng 69 hoặc 70, sử dụng dòng đầu tiên làm tên trường. Nếu không, 7 sẽ nhập dòng đầu tiên dưới dạng tài liệu riêng biệt. 68 when importing JSON data, 7 will return an error. 68 is only for
CSV or TSV imports. 75New trong phiên bản 100.0.0.New in version 100.0.0. Giải thích các số tự nhiên trong các trường dưới dạng chỉ mục mảng khi nhập các tệp CSV hoặc TSV.CSV or TSV files. Tên trường phải ở dạng 76 trong đó 77 là số tự nhiên bắt đầu bằng 78 và tăng tuần tự bằng 79 cho mỗi thành viên của mảng.Ví dụ: với tệp CSV sau:CSV file:
Nhập với tùy chọn 75 sẽ dẫn đến tài liệu sau: 75 option would result in the following document:
Nếu sử dụng tùy chọn 46, hãy sử dụng biểu mẫu 82 để chỉ định cả chỉ mục mảng và loại cho mỗi trường. Xem 46 để biết thêm thông tin. 46 option as well, use the form 82 to specify both the array index and type for each field. See 46 for more information.Các khóa số có các số không hàng đầu (ví dụ: 84) không được hiểu là chỉ số mảng.Nếu phần đầu tiên của khóa là số tự nhiên (ví dụ: 85), thì nó được hiểu là khóa tài liệu chứ không phải là chỉ mục mảng.Nếu sử dụng tùy chọn 58 với 75, 7 sẽ ghi lại lỗi nếu bạn cố gắng nhập tài liệu chứa giá trị trống (ví dụ: 89) cho trường chỉ mục mảng. 58 option with 75,
7 will log an error if you attempt to import a document that contains a blank value (e.g. 89) for an array index field.Tùy chọn 75 không có tác dụng khi nhập dữ liệu JSON, vì các mảng đã được mã hóa ở định dạng JSON. 75 option has no effect when importing
JSON data, as arrays are already encoded in JSON format. 91Default: ChènDefault: insert Chỉ định cách quá trình nhập nên xử lý các tài liệu hiện có trong cơ sở dữ liệu khớp với các tài liệu trong tệp nhập. Theo mặc định, 7 sử dụng trường 93 để khớp các tài liệu trong bộ sưu tập với các tài liệu trong tệp nhập. Để chỉ định các trường để phù hợp với các tài liệu hiện có cho các chế độ 94, 95 và 96, hãy sử dụng 97 7 uses the 93 field to match documents in the collection with documents in the import file. To specify the fields against which to match existing documents for the 94, 95, and 96 modes, use 97 98 Chỉ định danh sách các trường cho phần truy vấn của quy trình nhập. 97 có thể được sử dụng với 00 94, 95 và 96.Specifies a list of fields for the query portion of the import process. --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 94, 95, and 96.Sử dụng tùy chọn này nếu các trường 93 trong các tài liệu hiện có không khớp với trường trong tài liệu, nhưng một kết hợp trường hoặc trường khác có thể xác định duy nhất các tài liệu làm cơ sở để thực hiện các hoạt động UPSERT.Nếu bạn không chỉ định một trường, 97 sẽ tăng lên trên cơ sở của trường 93. 97 will upsert on the basis of the 93 field.Để đảm bảo hiệu suất đầy đủ, các chỉ mục nên tồn tại cho trường hoặc các trường bạn chỉ định với 97 97 08Forces 7 để tạm dừng hoạt động chèn ở lỗi đầu tiên thay vì tiếp tục thao tác mặc dù có lỗi.Forces --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Theo mặc định, 7 tiếp tục hoạt động khi gặp các lỗi xác thực khóa và khóa trùng lặp. Để đảm bảo rằng chương trình dừng các lỗi này, chỉ định 08 7 continues an operation when it encounters duplicate key and document validation errors. To ensure that the program stops on these errors, specify 08 12Chips Việc nhập dữ liệu được biểu thị bằng nhiều tài liệu MongoDB trong một mảng JSON duy nhất. Giới hạn trong nhập khẩu từ 16 MB hoặc nhỏ hơn.Accepts the import of data expressed with multiple MongoDB documents within a single JSON array. Limited to imports of 16 MB or smaller. Sử dụng 12 kết hợp với 14 12 in conjunction with 14 7 Indicated rằng dữ liệu nhập ở định dạng JSON v1 mở rộng thay vì định dạng JSON v2 mở rộng mặc định.Indicates that the import data is in Extended JSON v1 format instead of the default Extended JSON v2 format. MẹoVí dụ: nếu dữ liệu nhập ở định dạng V1: 0Nhập mà không có tùy chọn 7 dẫn đến tài liệu sau trong bộ sưu tập: 7 option results in the following document in the
collection: 1Nhập với kết quả 7 trong tài liệu sau trong bộ sưu tập: 7 results in the following document in the collection: 2 18Default: SaiDefault: false Nếu được chỉ định, 7 chèn các tài liệu theo thứ tự xuất hiện của chúng trong nguồn đầu vào. Đó là, cả thứ tự viết hàng loạt và đơn đặt hàng tài liệu trong các lô đều được duy trì. 7 inserts the documents in the order of their appearance in the input
source. That is, both the bulk write batch order and document order within the batches are maintained.Chỉ định 18 cũng cho phép 08 và đặt 22 thành 1. 18 also enables 08 and sets
22 to 1.Nếu không xác định, 7 có thể thực hiện các phần chèn theo thứ tự tùy ý. 7 may perform the insertions in an arbitrary order. 24Default: 1Default: 1 Chỉ định số lượng nhân viên chèn để chạy đồng thời. Đối với nhập khẩu lớn, việc tăng số lượng công nhân chèn có thể tăng tốc độ nhập khẩu. 25Default: Đa sốDefault: majority Chỉ định mối quan tâm ghi cho mỗi thao tác ghi mà 7 thực hiện.write concern for each write operation that
7 performs.Chỉ định mối quan tâm ghi là một tài liệu với các tùy chọn W:w options: 3Nếu mối quan tâm ghi cũng được bao gồm trong 27, dòng lệnh 2 sẽ ghi đè lên mối quan tâm ghi được chỉ định trong chuỗi URI. 27, the command-line 2 overrides the write concern specified in the URI string. 29Enables 7 để bỏ qua xác thực tài liệu trong quá trình hoạt động. Điều này cho phép bạn chèn các tài liệu không đáp ứng các yêu cầu xác nhận.Enables --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 46Instructs 7 Danh sách trường được chỉ định trong 45, 52 hoặc 68 Chỉ định các loại của mỗi trường.Instructs --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" Tên trường phải ở dạng 36. Bạn phải lùi lại các ký tự sau nếu bạn muốn đưa chúng vào một đối số: 37, 38 và 39.
Xem Nhập CSV với các loại trường được chỉ định để sử dụng mẫu.Import CSV with Specified Field Types for sample usage. Nếu bạn cố gắng bao gồm 46 khi nhập dữ liệu JSON, 7 sẽ trả về lỗi. 46 chỉ dành cho nhập khẩu CSV hoặc TSV. 46 when importing JSON data,
7 will return an error. 46 is only for CSV or
TSV imports. 72Default: Dừng lạiDefault: stop Chỉ định cách 7 xử lý các lỗi cưỡng chế loại khi nhập tệp CSV hoặc TSV với 46 7 handles type coercion failures when importing CSV or TSV files with 46--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
Chạy 7 từ dòng lệnh hệ thống, không phải shell 0. 7 from the system command line, not the 0 shell.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" 8. Most of the arguments to 8 also exist for
7Trong ví dụ sau, 7 nhập dữ liệu JSON từ tệp 93 vào bộ sưu tập 94 trong cơ sở dữ liệu 95. 7 imports the JSON data from the 93 file into
the collection 94 in the 95 database. 4Với 00 94, 7 thay thế các tài liệu hiện có trong cơ sở dữ liệu khớp với tài liệu trong tệp nhập với tài liệu từ tệp nhập. Các tài liệu không khớp với một tài liệu hiện có trong cơ sở dữ liệu được chèn như bình thường. Theo mặc định 7 khớp với các tài liệu dựa trên trường 93. Sử dụng 97 để chỉ định các trường để phù hợp với. 00 94, 7 replaces existing documents in the database that match a document in the import file with the document from the
import file. Documents that do not match an existing document in the database are inserted as usual. By default 7 matches documents based on the 93 field. Use 97 to specify the fields to match against.Hãy xem xét tài liệu sau trong bộ sưu tập 02 trong cơ sở dữ liệu 03: 5Tài liệu sau đây tồn tại trong tệp JSON 04. Trường 93 của đối tượng JSON khớp với trường 93 của tài liệu trong bộ sưu tập 02. 6Để nhập tệp 04 và thay thế các tài liệu trong cơ sở dữ liệu phù hợp với các tài liệu trong tệp nhập, chỉ định 00 94, như sau: 00 94, as in the following: 7Tài liệu trong bộ sưu tập 02 sau đó sẽ chỉ chứa các trường từ tài liệu đã nhập, như trong phần sau: 6Với 00 95, 7 cho phép bạn hợp nhất các trường từ một bản ghi mới với một tài liệu hiện có trong cơ sở dữ liệu. Các tài liệu không khớp với một tài liệu hiện có trong cơ sở dữ liệu được chèn như bình thường. Theo mặc định 7 khớp với các tài liệu dựa trên trường 93. Sử dụng 97 để chỉ định các trường để phù hợp với. 00 95, 7 enables you to merge fields from a new record with an existing document in the database. Documents that do not match an existing document in the database are inserted as usual. By default
7 matches documents based on the 93 field. Use 97 to specify the fields to match against.Bộ sưu tập 02 trong cơ sở dữ liệu 03 chứa tài liệu sau: 5Tài liệu sau đây tồn tại trong tệp JSON 04. Trường 93 của đối tượng JSON khớp với trường 93 của tài liệu trong bộ sưu tập 02. 0Để nhập tệp 04 và thay thế các tài liệu trong cơ sở dữ liệu phù hợp với các tài liệu trong tệp nhập, chỉ định 00 94, như sau: 00 95, as in the following: 1Tài liệu trong bộ sưu tập 02 sau đó sẽ chỉ chứa các trường từ tài liệu đã nhập, như trong phần sau: 7 adds the new 29 and 30 fields to the document and updates the 31 field with the value from the imported document, as in the following: 2
Với 00 95, 7 cho phép bạn hợp nhất các trường từ một bản ghi mới với một tài liệu hiện có trong cơ sở dữ liệu. Các tài liệu không khớp với một tài liệu hiện có trong cơ sở dữ liệu được chèn như bình thường. Theo mặc định 7 khớp với các tài liệu dựa trên trường 93. Sử dụng 97 để chỉ định các trường để phù hợp với.Bộ sưu tập 02 trong cơ sở dữ liệu 03 chứa tài liệu sau: 00 96, 7 deletes existing documents in the database that match a document in the import file. Documents that do not match an existing document in the
database are ignored. By default 7 matches documents based on the 93 field. Use 97 to specify the fields to match against.Để nhập tệp mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]04 và hợp nhất các tài liệu từ tệp nhập với các tài liệu phù hợp trong cơ sở dữ liệu, chỉ định --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"00password: |
password: |
uri: mongodb://mongodb0.example.com:27017 |
sslPEMKeyPassword: |
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 thêm các trường mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
29 và mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
30 mới vào tài liệu và cập nhật trường mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
31 với giá trị từ tài liệu đã nhập, như sau:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
00password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
96, --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 will only delete one existing document per match. Ensure that documents from the import file match a single existing document from the database.Bộ sưu tập
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
02 trong cơ sở dữ liệu mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
03 chứa tài liệu sau:password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
3Tài liệu sau đây tồn tại trong tệp JSON
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
04. Trường password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
93 của đối tượng JSON khớp với trường password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
93 của tài liệu trong bộ sưu tập mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
02.password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
4Để xóa các tài liệu trong cơ sở dữ liệu phù hợp với tài liệu trong tệp
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
04, chỉ định --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
00password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
96, như sau:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
00password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
96, as in the
following:password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
5Vì các trường
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
93 khớp giữa cơ sở dữ liệu và tệp đầu vào, --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 xóa tài liệu phù hợp khỏi bộ sưu tập mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
02. Các kết quả tương tự cũng có thể đạt được bằng cách sử dụng password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
97 để chỉ định trường mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
54, cũng phù hợp giữa cơ sở dữ liệu và tệp đầu vào.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 deletes the matching document from the mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
02 collection. The same results could also have been achieved by using
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
97 to specify the mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
54 field, which also matches between the database and the input file.Trong ví dụ sau,
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 Nhập dữ liệu từ tệp mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
56 vào bộ sưu tập --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
94 trong cơ sở dữ liệu mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
58 trên cơ sở dữ liệu MongoDB từ xa có bật xác thực.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 imports data from the file mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
56 into the
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
94 collection within the database mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
58 on a remote MongoDB database with authentication enabled.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" --host= mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] --host= --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" --host=
7 kết nối với ví dụ
0 chạy trên máy chủ
61 qua cổng
62. Nó xác thực với tên người dùng
63; Ví dụ bỏ qua tùy chọn
9 để có lời nhắc
7 cho mật khẩu: connects to the
0 instance running on the host
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
61 over port
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
62. It authenticates with the username mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
63; the example omits the --host=<:port>
9 option to have --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 prompt for the password:password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
6Trong ví dụ sau,
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 nhập dữ liệu được định dạng CSV trong tệp mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
67 vào bộ sưu tập --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
94 trong cơ sở dữ liệu --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
95 trên thể hiện MongoDB chạy trên cổng localhost được đánh số mongoexport --jsonFormat=canonical --collection=
23.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 imports the CSV formatted data in the mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
67 file into the collection --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
94 in the --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
95 database on the MongoDB instance running on the localhost port numbered mongoexport --jsonFormat=canonical --collection=
23.Chỉ định
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
68 Hướng dẫn --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 để xác định tên của các trường bằng dòng đầu tiên trong tệp CSV.password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
68 instructs --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 to determine the name of the fields using the first line in the CSV file.password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
7--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]" mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
7 sử dụng tên tệp đầu vào, không có phần mở rộng, làm tên thu thập nếu
74 hoặc
42 không được xác định. Do đó, ví dụ sau đây tương đương: uses the input file name, without the extension, as the collection name if password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
74 or password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
42 is unspecified. The following example is therefore equivalent:password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
8Khi chỉ định tên trường, bạn cũng có thể chỉ định kiểu dữ liệu. Để chỉ định tên trường và loại, bao gồm
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
46 với: password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
45, password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
52 hoặc password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
68password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
46 with either: password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
45, password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
52, or
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
68Chỉ định tên trường và loại dữ liệu trong mẫu
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
36.Ví dụ: tệp
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
81 chứa các dữ liệu sau:password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
9Hoạt động sau sử dụng
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 với tùy chọn password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
45 và password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
46 để chỉ định cả tên trường và các loại BSON của dữ liệu CSV đã nhập.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 with the
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
45 and password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
46 option to specify both the field names and the BSON types of the imported CSV data.--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
0Sử dụng tùy chọn
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
58 để bỏ qua các trường trống. Đối với nhập CSV và TSV, tùy chọn này cung cấp chức năng mong muốn trong hầu hết các trường hợp vì nó tránh chèn các trường có giá trị null vào bộ sưu tập của bạn.password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
58 option to ignore blank fields. For CSV and TSV imports, this option provides
the desired functionality in most cases because it avoids inserting fields with null values into your collection.Ví dụ sau nhập dữ liệu từ
mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
86, bỏ qua bất kỳ trường trống nào:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
1Mới trong phiên bản 100.1.0.
Để 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 --jsonFormat=canonical --collection=
15 đến --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 tương tự như sau:MongoDB Atlas cluster which has been configured to support authentication via
AWS IAM credentials, provide a mongoexport --jsonFormat=canonical --collection=
15 to --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 similar to the following:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
2Kết nối với Atlas bằng thông tin AWS IAM theo cách này sử dụng
mongoexport --jsonFormat=canonical --collection=
87 mongoexport --jsonFormat=canonical --collection=
88 và password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
22 mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
92, như trong ví dụ này.mongoexport --jsonFormat=canonical --collection=
88 and the password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
22 mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
92, as shown in this example.
Nếu cũng sử dụng mã thông báo phiên AWS, hãy cung cấp cho nó giá trị
password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
11 password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
12, như sau:AWS session token, as well, provide it with the password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
11 password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
12 value, as follows:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
3Ghi chú
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:
Những ký tự đó phải được chuyển đổi bằng cách sử dụng phần trăm mã hóa.percent encoding.
Ngoài ra, ID khóa truy cập AWS, khóa truy cập bí mật và mã thông báo phiên tùy chọn có thể được cung cấp bên ngoài chuỗi kết nối bằng các tùy chọn
--host=<:port>
8, --host=<:port>
9 và mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
97 thay vào đó, như vậy:--host=<:port>
8, --host=<:port>
9, and mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
97 options instead, like so:--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
4Khi đượ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.
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 Kiểm tra các biến môi trường sau khi bạn sử dụng mongoexport --jsonFormat=canonical --collection=
87 mongoexport --jsonFormat=canonical --collection=
88AWS IAM environment variables. --uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 checks
for the following environment variables when you use the mongoexport --jsonFormat=canonical --collection=
87 mongoexport --jsonFormat=canonical --collection=
88
90mongoexport --jsonFormat=canonical --collection=
03password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
11password: uri: mongodb://mongodb0.example.com:27017 sslPEMKeyPassword:
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 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:or specify each of these using the explicit or connection string options instead.
Những ký tự đó phải được chuyển đổi bằng cách sử dụng phần trăm mã hóa.
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
5Ngoài ra, ID khóa truy cập AWS, khóa truy cập bí mật và mã thông báo phiên tùy chọn có thể được cung cấp bên ngoài chuỗi kết nối bằng các tùy chọn
--host=<:port>
8, --host=<:port>
9 và mongoimport mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
97 thay vào đó, như vậy: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.
--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
7 Kiểm tra các biến môi trường sau khi bạn sử dụng mongoexport --jsonFormat=canonical --collection=
87 mongoexport --jsonFormat=canonical --collection=
88--uri "mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]"
6