西奥-数据库

theo-database的Python项目详细描述


theo数据库

它是一个易于控制数据库的数据库。

MongoDB由控制MongoDB的方法组成。

我很可能在等待任何形式的贡献。

西奥系列

框架:pip安装theo框架,https://github.com/TheodoreWon/python-theo-framework
数据库:pip安装theo数据库,https://github.com/TheodoreWon/python-theo-database
消息:pip install theo消息,https://github.com/TheodoreWon/python-theo-message
互联网:pip安装theo消息,https://github.com/TheodoreWon/python-theo-internet
trade:pip安装theo trade,https://github.com/TheodoreWon/python-theo-trade

如何使用

安装框架

pip install theo-database

打印文档字符串

from theo.database import MongoDB, MongoDBCtrl
print(MongoDB.__doc__)
print(MongoDBCtrl.__doc__)

简单示例

''' import theo-database, MongoDB '''
from theo.database import MongoDB
mongodb = MongoDB(check_connection=True)

''' print databases '''
databases = mongodb.get_databases()
print('databases:{}'.format(databases))

databases:['Athena', 'admin', 'config', 'local']

''' print collections '''
for database in databases:
collections = mongodb.get_collections(database)
print('database({}) collections:{}'.format(database, collections))

database(admin) collections:['system.version']
database(config) collections:['system.sessions']
database(local) collections:['startup_log']

''' print existence '''
print('theo-database/example exist:{}'.format(mongodb.is_database_exist('theo-database')))
print('theo-database/example exist:{}'.format(mongodb.is_collection_exist('theo-database', 'example')))

theo-database/example exist:False
theo-database/example exist:False

''' save and load data '''
mongodb.insert('theo-database', 'example', [{'text': 'Hello, theo-database.'}, {'text': 'Thank you for using.'}])
print('theo-database/example exist:{}'.format(mongodb.is_database_exist('theo-database')))
print('theo-database/example exist:{}'.format(mongodb.is_collection_exist('theo-database', 'example')))
print(mongodb.select('theo-database', 'example'))

theo-database/example exist:True
theo-database/example exist:True
[{'text': 'Hello, theo-database.'}, {'text': 'Thank you for using.'}]

''' drop collection '''
mongodb.drop_collection('theo-database', 'example')
print('theo-database/example exist:{}'.format(mongodb.is_database_exist('theo-database')))
print('theo-database/example exist:{}'.format(mongodb.is_collection_exist('theo-database', 'example')))

theo-database/example exist:False
theo-database/example exist:False

如何设置MongoDB

第一步。下载

Open the website, https://www.mongodb.com/
Find and click the 'Get MongoDB' button from top of the page
Select 'Server' of the list Cloud, Server, Tools
Check the environment, Version, OS, Package and click the 'Download' button

第二步。安装

Execute the installer what is downloaded
Follow the install steps and un-check 'Install MongoDB Compass'

第三步。在Windows中将MongoDB设置为服务

Make new folder like C:\Users\wonta\mongodb
Run cmd (command prompt) as Administrator
Go to the MongoDB location like C:\Program Files\MongoDB\Server\4.0\bin
Enter the command 'mongod --remove'
Enter the command 'mongod --dbpath=C:\Users\wonta\mongodb --logpath=C:\Users\wonta\mongodb\log.txt --install'
Restart the windows

作者

Theodore Won-该项目的所有者

许可证

此项目是根据麻省理工学院的许可证授权的-有关详细信息,请参见许可证文件

版本控制

基本上,这个项目遵循“语义版本控制”。(https://semver.org/
但是,为了通知新特性,我在语义版本控制中添加了几个简单的规则。
我想叫“Theo版本控制”。

  • 版本格式为major.minor.patch
  • 当api改变或提供新特性时,主版本会增加。
    • 新功能不影响界面。
    • 但是,为了通知新特性,新特性会生成主版本。
    • 在正式版本发布(1.0.0)之前,主版本保持为0,次版本使用。
  • 添加API时,次要版本已启动。(新功能)
  • 修补程序版本在修复错误、上载测试代码、更新注释或文档或日志时解除。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
分离实体上的java JPA merge()在其存在时进行插入   java Android Javamail自定义身份验证   java如何找出EAR包中执行的第一个文件   sockets Java:如何重用SocketChannel   java通过MQTT和ssl连接安卓设备   java如何修复控制台中的“未知命令”错误?   java为多线程FizzBuzz编写测试用例   java解析findBy中的嵌套对象属性   异常Java:在这种特殊情况下,如何处理ConcurrentModificationException?   从java教科书中绘制图形   java找不到类型为com的响应对象的MessageBodyWriter。太阳运动衫应用程序编程接口。json。JSONWithPadding媒体类型:application/xjavascript   java如何在Android中将光标设置在tableLayout的行/列中所需的位置   Elasticsearch:java。lang.IllegalArgumentException:在docker容器上运行时不允许自我抑制   如何在Java中继承此方法?   java为什么我的消息消费者不接收所有其他消息?   java为什么@ApplicationScoped bean在CDI扩展的关闭前阶段有一个新实例?