<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          MangoDBMongoDB 開源替代品

          聯(lián)合創(chuàng)作 · 2023-10-01 01:43

          MangoDB 是 MongoDB 的開源替代品,它會將 MongoDB 的線協(xié)議查詢轉(zhuǎn)換為 SQL,并使用 PostgreSQL 作為數(shù)據(jù)庫引擎。

          MangoDB 兼容 MongoDB 的驅(qū)動,官方稱其在許多情況下可作為 MongoDB 的直接替代品。

          使用示例

          1. 先在docker-compose.yml文件保存以下內(nèi)容:

          version: "3"
          
          services:
            postgres:
              image: postgres:14
              container_name: postgres
              ports:
                - 5432:5432
              environment:
                - POSTGRES_USER=user
                - POSTGRES_DB=mangodb
                - POSTGRES_HOST_AUTH_METHOD=trust
          
            postgres_setup:
              image: postgres:14
              restart: on-failure
              entrypoint: ["sh", "-c", "psql -h postgres -U user -d mangodb -c 'CREATE SCHEMA IF NOT EXISTS test'"]
          
            mangodb:
              image: ghcr.io/mangodb-io/mangodb:latest
              container_name: mangodb
              ports:
                - 27017:27017
              command: ["--listen-addr=:27017", "--postgresql-url=postgres://user@postgres:5432/mangodb"]

          2. 通過postgres 容器運行存儲數(shù)據(jù)的 PostgreSQL 14 數(shù)據(jù)庫

          3. 使用postgres_setup容器創(chuàng)建一個 PostgreSQL schematest,其作用類似于同名的 MangoDB 數(shù)據(jù)庫

          4. 使用mangodb 運行 MangoDB

          5. 使用docker-compose up -d啟動服務(wù)

          6. 如果已經(jīng)安裝mongosh,只需運行它即可連接到 MangoDB 數(shù)據(jù)庫test。如果沒有,在臨時 MongoDB 容器內(nèi)運行運行以下命令mongosh,并將其附加到同一個 Docker 網(wǎng)絡(luò):

          docker run --rm -it --network=mangodb_default --entrypoint=mongosh mongo:5 mongodb://mangodb/
          瀏覽 15
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  精品人妻一区二区三区奶水 | 国产黄色三级片 | 黄色五月天婷婷 | 99草在线视频 | 性欧美tube |