Skip to main content

将json导入mongodb

Project description

导入方法

pip install insert_mongodb

注意事项

要导入的json文件为下面的格式

[
{"xxx":"xxx"},
["xxx","xxx"]
]

小贴士

搭配mongodb_to_other库使用更加

注意

使用本库但是函数选择错误者,若数据丢失,我概不负责

1.Import_different_items函数

1.1导入

from insert_mongodb import Import_different_items
    #倒库
Import_different_items("数据库","集合名","要导入的文件路径",port=int('数据库端口(默认为27017)'),ip="mongodb数据库所在的ip地址(默认为127.0.0.1)",name="数据库用户名(默认为None)",password="数据库密码(默认为None)")

1.2 功能详解

导入在mongodb中不存在的集合并且保留原数据

2.Import_retain_different_items函数

2.1导入

from insert_mongodb import Import_retain_different_items
    #倒库
Import_retain_different_items("数据库","集合名","要导入的文件路径",port=int('数据库端口(默认为27017)'),ip="mongodb数据库所在的ip地址(默认为127.0.0.1)",name="数据库用户名(默认为None)",password="数据库密码(默认为None)")

2.2 功能详解

导入在mongodb中不存在的集合不保留原数据

3.Import_cover_new_items函数

3.1 导入

from insert_mongodb import Import_cover_new_items
    #倒库
Import_cover_new_items("数据库","集合名","要导入的文件路径",port=int('数据库端口(默认为27017)'),ip="mongodb数据库所在的ip地址(默认为127.0.0.1)",name="数据库用户名(默认为None)",password="数据库密码(默认为None)")

3.2 功能详解

导入全部新的的集合不保留原数据

4.append_new_items函数

4.1导入

from insert_mongodb import append_new_items
    #倒库
append_new_items("数据库","集合名","要导入的文件路径",port=int('数据库端口(默认为27017)'),ip="mongodb数据库所在的ip地址(默认为127.0.0.1)",name="数据库用户名(默认为None)",password="数据库密码(默认为None)")

4.2 功能详解

导入全部新的的集合保留原数据

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

insert_mongodb-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file insert_mongodb-0.1.1.tar.gz.

File metadata

  • Download URL: insert_mongodb-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for insert_mongodb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 025e5ca8c48f65047ca54b6b0e297c757c589aa63cbb272b91e81d9f8e01683a
MD5 7c9378a9e026067cd447e085d8866fb1
BLAKE2b-256 8652b939765dd0d9f1d0a43f08c82ad56cc7da2fb7b4b5dca4c539a4302480d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page