Hướng dẫn trino mongodb - trino mongodb

Hướng dẫn trino mongodb - trino mongodb

Đầu nối

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
5 cho phép sử dụng các bộ sưu tập MongoDB làm bảng trong Trino.

Show

Yêu cầu#

Để kết nối với MongoDB, bạn cần:

  • MongoDB 4.0 trở lên.

  • Truy cập mạng từ Điều phối viên Trino và Công nhân đến MongoDB. Cổng 27017 là cổng mặc định.

  • Viết quyền truy cập vào Bộ sưu tập thông tin lược đồ trong MongoDB.schema information collection in MongoDB.

Configuration#

Để định cấu hình đầu nối MongoDB, hãy tạo tệp thuộc tính danh mục

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
6 với các nội dung sau, thay thế các thuộc tính nếu thích hợp:

connector.name=mongodb
mongodb.connection-url=mongodb://user:[email protected]:27017/

Nhiều cụm mongoDB#

Bạn có thể có nhiều danh mục như bạn cần, vì vậy nếu bạn có thêm các cụm MongoDB, chỉ cần thêm một tệp thuộc tính khác vào

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
7 với một tên khác, đảm bảo nó kết thúc trong
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
8). Ví dụ: nếu bạn đặt tên cho tệp thuộc tính
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
9, Trino sẽ tạo một danh mục có tên
{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
0 bằng trình kết nối được cấu hình.

Thuộc tính Cấu hình#

Các thuộc tính cấu hình sau đây có sẵn:

Tên tài sản

Sự mô tả

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
1

Danh sách tất cả các máy chủ MongoDB

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
2

URL kết nối mà người lái sử dụng để kết nối với triển khai MongoDB

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
3

Một bộ sưu tập chứa thông tin lược đồ

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
4

Khớp với cơ sở dữ liệu và tên thu thập trường hợp vô cảm

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
5

Danh sách thông tin đăng nhập

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
6

Kích thước tối thiểu của nhóm kết nối trên mỗi máy chủ

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
7

Kích thước tối đa của nhóm kết nối trên mỗi máy chủ

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
8

Thời gian chờ tối đa

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
9

Thời gian nhàn rỗi tối đa của kết nối gộp

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
0

Thời gian chờ kết nối ổ cắm

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
1

Thời gian chờ ổ cắm

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
2

Sử dụng TLS/SSL cho các kết nối với Mongod/Mongos

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
3

Các ưu tiên đọc

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
4

Mối quan tâm viết

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
5

Tên bộ bản sao bắt buộc

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
6

Số lượng các yếu tố để trả lại trong một đợt

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 1#

Danh sách được phân tách bằng dấu phẩy của

{
    "name": ...,
    "type": ...,
    "hidden": ...
}
8 Tất cả các máy chủ MongoDB trong cùng một bộ bản sao hoặc danh sách các máy chủ MongoDB trong cùng một cụm bị chia cắt. Nếu một cổng không được chỉ định, cổng 27017 sẽ được sử dụng.

Tài sản này không được dùng và sẽ bị xóa trong một bản phát hành trong tương lai. Sử dụng thuộc tính

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
2 thay thế.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 2#

Một chuỗi kết nối chứa giao thức, thông tin xác thực và thông tin máy chủ để sử dụng kết nối với triển khai MongoDB của bạn.

Ví dụ: chuỗi kết nối có thể sử dụng định dạng

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
1 hoặc
CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
2, tùy thuộc vào giao thức được sử dụng. Thông tin đăng nhập người dùng/Pass phải dành cho người dùng có quyền truy cập ghi vào Bộ sưu tập thông tin lược đồ.schema information collection.

Xem URI kết nối MongoDB để biết thêm thông tin.

Tài sản này là bắt buộc; Không có mặc định. Một URL kết nối hoặc hạt giống phải được cung cấp để kết nối với triển khai MongoDB.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 3#

Vì MongoDB là cơ sở dữ liệu tài liệu, không có thông tin lược đồ cố định trong hệ thống. Vì vậy, một bộ sưu tập đặc biệt trong mỗi cơ sở dữ liệu MongoDB nên xác định lược đồ của tất cả các bảng. Vui lòng tham khảo phần định nghĩa bảng để biết chi tiết.Table definition section for the details.

Khi khởi động, trình kết nối cố gắng đoán loại dữ liệu của các trường dựa trên ánh xạ loại.type mapping.

Dự đoán ban đầu có thể không chính xác cho bộ sưu tập cụ thể của bạn. Trong trường hợp đó, bạn cần sửa đổi nó bằng tay. Vui lòng tham khảo phần định nghĩa bảng để biết chi tiết.Table definition section for the details.

Tạo các bảng mới bằng cách sử dụng

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
4 và
CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
5 tự động tạo một mục nhập cho bạn.

Tài sản này là tùy chọn; Mặc định là

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
6.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 4#

Khớp cơ sở dữ liệu và tên thu thập trường hợp vô cảm.

Tài sản này là tùy chọn; Mặc định là

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
8.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 5#

Một danh sách phân tách dấu phẩy của thông tin

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
0.

Tài sản này là tùy chọn; Không có giá trị mặc định.

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
1 phải là cơ sở dữ liệu xác thực cho người dùng (ví dụ:
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
2).

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 6#

Số lượng kết nối tối thiểu trên mỗi máy chủ cho ví dụ MongoClient này. Những kết nối đó được giữ trong một nhóm khi không hoạt động và nhóm đảm bảo theo thời gian mà nó chứa ít nhất số tối thiểu này.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 7#

Số lượng kết nối tối đa cho phép trên mỗi máy chủ cho trường hợp MongoClient này. Những kết nối đó được giữ trong một hồ bơi khi nhàn rỗi. Khi nhóm bị cạn kiệt, bất kỳ hoạt động nào yêu cầu một khối kết nối đang chờ kết nối có sẵn.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
6.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 8#

Thời gian chờ tối đa tính bằng mili giây, một luồng có thể chờ kết nối có sẵn. Giá trị của

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4 có nghĩa là nó không chờ đợi. Một giá trị âm có nghĩa là chờ đợi vô thời hạn để kết nối có sẵn.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
9.

{ "table": ..., "fields": [ { "name" : ..., "type" : "varchar|bigint|boolean|double|date|array(bigint)|...", "hidden" : false }, ... ] } } 9#

Thời gian nhàn rỗi tối đa của kết nối gộp trong mili giây. Giá trị của

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4 cho thấy không có giới hạn cho thời gian nhàn rỗi. Một kết nối gộp đã vượt quá thời gian nhàn rỗi của nó sẽ được đóng và thay thế khi cần thiết bằng một kết nối mới.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4.

{ "name": ..., "type": ..., "hidden": ... } 0#

Thời gian chờ kết nối tính bằng mili giây. Giá trị của

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4 có nghĩa là không có thời gian chờ. Nó chỉ được sử dụng khi thiết lập một kết nối mới.

Tài sản này là tùy chọn; Mặc định là

SELECT _id, * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
5.

{ "name": ..., "type": ..., "hidden": ... } 1#

Thời gian chờ ổ cắm tính bằng mili giây. Nó được sử dụng cho các hoạt động đọc và ghi ổ I/O.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4 và có nghĩa là không có thời gian chờ.

{ "name": ..., "type": ..., "hidden": ... } 2#

Cờ này cho phép kết nối SSL đến máy chủ MongoDB.

Tài sản này là tùy chọn; Mặc định là

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
8.

{ "name": ..., "type": ..., "hidden": ... } 3#

Các ưu tiên đọc để sử dụng cho các truy vấn, giảm MAP, tổng hợp và đếm. Các giá trị có sẵn là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
1,
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
2,
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
3,
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
4 và
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
5.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
1.

{ "name": ..., "type": ..., "hidden": ... } 4#

Các mối quan tâm viết để sử dụng. Các giá trị có sẵn là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
8,
                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
9,
SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
0 và
SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
1.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)
8.

{ "name": ..., "type": ..., "hidden": ... } 5#

Tên đặt bản sao bắt buộc. Với tùy chọn này được đặt, phiên bản Mongoclient thực hiện các hành động sau:

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.

Tài sản này là tùy chọn; Không có giá trị mặc định.

{ "name": ..., "type": ..., "hidden": ... } 6#

Giới hạn số lượng các yếu tố được trả lại trong một lô. Một con trỏ thường lấy một lô các đối tượng kết quả và lưu trữ chúng tại địa phương. Nếu BatchSize là 0, mặc định của trình điều khiển được sử dụng. Nếu Batchsize là dương, nó đại diện cho kích thước của mỗi lô các đối tượng được truy xuất. Nó có thể được điều chỉnh để tối ưu hóa hiệu suất và giới hạn truyền dữ liệu. Nếu lô âm là âm, nó giới hạn số lượng đối tượng được trả về, phù hợp với giới hạn kích thước lô tối đa (thường là 4MB) và con trỏ được đóng lại. Ví dụ: nếu BatchSize là -10, thì máy chủ sẽ trả về tối đa 10 tài liệu và nhiều hơn nữa có thể phù hợp với 4MB, sau đó đóng con trỏ.

Ghi chú

Không sử dụng kích thước lô là

SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
5.

Tài sản này là tùy chọn; Mặc định là

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)
4.

Định nghĩa bảng#

MongoDB duy trì các định nghĩa bảng trên bộ sưu tập đặc biệt trong đó giá trị cấu hình

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
3 Chỉ định.

Ghi chú

Không sử dụng kích thước lô là

SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
5.

Định nghĩa bảng#

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}

MongoDB duy trì các định nghĩa bảng trên bộ sưu tập đặc biệt trong đó giá trị cấu hình

{
    "table": ...,
    "fields": [
          { "name" : ...,
            "type" : "varchar|bigint|boolean|double|date|array(bigint)|...",
            "hidden" : false },
            ...
        ]
    }
}
3 Chỉ định.

Không có cách nào để plugin phát hiện một bộ sưu tập bị xóa. Bạn cần xóa mục nhập bằng

SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
8 trong vỏ Mongo. Hoặc bỏ một bộ sưu tập bằng cách chạy
SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
9 bằng Trino.

Một bộ sưu tập lược đồ bao gồm một tài liệu MongoDB cho một bảng.

Trình kết nối trích dẫn các trường cho một loại hàng khi tự động tạo lược đồ. Tuy nhiên, nếu lược đồ đang được cố định thủ công trong bộ sưu tập thì các trường cần được trích dẫn rõ ràng.

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
0

Đồng ruộng

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
1

Yêu cầu

Loại hình

Sự mô tả

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
2

Yêu cầu

Loại hình

Sự mô tả

yêu cầu

{
    "name": ...,
    "type": ...,
    "hidden": ...
}

Không có cách nào để plugin phát hiện một bộ sưu tập bị xóa. Bạn cần xóa mục nhập bằng

SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
8 trong vỏ Mongo. Hoặc bỏ một bộ sưu tập bằng cách chạy
SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');
9 bằng Trino.

Một bộ sưu tập lược đồ bao gồm một tài liệu MongoDB cho một bảng.

Trình kết nối trích dẫn các trường cho một loại hàng khi tự động tạo lược đồ. Tuy nhiên, nếu lược đồ đang được cố định thủ công trong bộ sưu tập thì các trường cần được trích dẫn rõ ràng.

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
0

Đồng ruộng

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
3

Yêu cầu

Loại hình

Sự mô tả

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
4

Yêu cầu

Loại hình

Sự mô tả

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
5

yêu cầu

boolean

sợi dây

Tên bảng Trino

ObjectId#

mảng

CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
 55 b1 51 67 38 64 d6 43 8c 61 a9 cf |        2 | good        |      100.0 | 2015-07-23
(2 rows)

Một danh sách các định nghĩa trường. Mỗi định nghĩa trường tạo ra một cột mới trong bảng Trino.

                 _id                 | orderkey | orderstatus | totalprice | orderdate
-------------------------------------+----------+-------------+------------+------------
 55 b1 51 63 38 64 d6 43 8c 61 a9 ce |        1 | bad         |       50.0 | 2015-07-23
(1 row)

Mỗi trường định nghĩa:

SELECT CAST(_id AS VARCHAR), * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)

Tên của cột trong bảng Trino.

Loại Trino của cột.

không bắt buộc(ObjectId) timestamp#

Ẩn cột từ

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
6 và
           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
7. Mặc định là
CREATE TABLE IF NOT EXISTS orders (
    orderkey bigint,
    orderstatus varchar,
    totalprice double,
    orderdate date
);

INSERT INTO orders VALUES(1, 'bad', 50.0, current_date);
INSERT INTO orders VALUES(2, 'good', 100.0, current_date);
SELECT _id, * FROM orders;
8.

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
0

Không có giới hạn về mô tả trường cho khóa hoặc thông báo.(timestamp) ObjectId#

Bộ sưu tập MongoDB có lĩnh vực đặc biệt

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
9. Trình kết nối cố gắng tuân theo các quy tắc tương tự cho lĩnh vực đặc biệt này, do đó sẽ có trường ẩn
           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
9.

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
1

SELECT _id, * FROM orders WHERE _id = ObjectId('55b151633864d6438c61a9ce');

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
2

Bạn có thể hiển thị trường

           _id             | orderkey | orderstatus | totalprice | orderdate
---------------------------+----------+-------------+------------+------------
 55b151633864d6438c61a9ce  |        1 | bad         |       50.0 | 2015-07-23
(1 row)
9 cho các giá trị có thể đọc được với một diễn viên thành
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
02:

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
3

Chức năng dấu thời gian của ObjectID#

Bốn byte đầu tiên của mỗi ObjectID đại diện cho một dấu thời gian nhúng của thời gian tạo của nó. Trino cung cấp một vài chức năng để tận dụng tính năng MongoDB này.modifies some types when reading or writing data. Data types may not map the same way in both directions between Trino and the data source. Refer to the following sections for type mapping in each direction.

objectid_timestamp (objectID) → dấu thời gian#

Trích xuất dấu thời gian với múi giờ từ một ObjectID đã cho:

objectid_timestamp (objectID) → dấu thời gian##

Trích xuất dấu thời gian với múi giờ từ một ObjectID đã cho:

Timestamp_ObjectID (Timestamp) → ObjectID#

Tạo một ObjectID từ dấu thời gian với múi giờ:

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
04

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
05

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
06

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
07

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
08

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
07

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
10

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
11

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
12

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
13

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
14

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
02

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
16

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
17

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
18

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
18

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
20

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
21

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
22

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
23

Bản đồ đến

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
21 nếu loại phần tử không phải là duy nhất.

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
25

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
21

Không có loại khác được hỗ trợ.

Trino to MongoDB Lập bản đồ#

Đầu nối ánh xạ các loại trino theo các loại MongoDB tương ứng theo bảng này:

Trino to MongoDB Lập bản đồ##

Đầu nối ánh xạ các loại trino theo các loại MongoDB tương ứng theo bảng này:

Loại Trino

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
05

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
04

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
07

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
08

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
11

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
10

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
13

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
12

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
02

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
14

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
17

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
16

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
18

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
18

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
21

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
20

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
23

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
22

Không có loại khác được hỗ trợ.

Trino to MongoDB Lập bản đồ#

Đầu nối ánh xạ các loại trino theo các loại MongoDB tương ứng theo bảng này:globally available and read operation statements, the connector supports the following features:

  • Loại Trino

  • Loại MongoDB

  • Hỗ trợ SQL#

  • Trình kết nối cung cấp quyền truy cập đọc và ghi vào dữ liệu và siêu dữ liệu trong MongoDB. Ngoài các câu lệnh hoạt động có sẵn trên toàn cầu và đọc, Trình kết nối hỗ trợ các tính năng sau:

  • CHÈN

  • TẠO BẢNG

  • Tạo bảng như

  • Bàn thả

Thay đổi bảng

Tạo lược đồ

Sơ đồ thả

BÌNH LUẬNtable functions to access MongoDB.

#. Connect in replica set mode, and discover all members of the set based on the given servers #. Make sure that the set name reported by all members matches the required set name. #. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name. 49#

Thay đổi bảng#

Trình kết nối hỗ trợ các hoạt động

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
45,
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
46 và
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
47. Các cách sử dụng khác của
#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
48 không được hỗ trợ.

#. Connect in replica set mode, and discover all members of the set based on the given servers
#. Make sure that the set name reported by all members matches the required set name.
#. Refuse to service any requests, if any member of the seed list is not part of a replica set with the required name.
4