Skip to main content

Easy mase-db use mongodb, motor asyncio

Project description

Mase-DB v1.1.8

Легкое использование базы данных монгодб.

##Документация

Документация:

  • Скоро будет!

Установка

# ЕСЛИ УСТНОВЛЕН
pip install --upgrade masedb

# ЕСЛИ НЕ УСТАНОВЛЕН
python3 -m pip install --upgrade masedb

##or

pip install masedb

Применение

Предпосылки

Прежде чем приступить к работе, вам понадобится несколько вещей:

  • Установить нужные для работы библиотеки
  • Так же установить masedb
  • И понять как это все работает

И так поехали!(жабы топ)

Примеры

from masedb.queries import *
from config import url
import asyncio

#--------------------------------------------------------------------------------------------------------------------------------------------------------

#await find_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'name': 'mark'})
#await insert_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'name': 'mark'})
#await update_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param1={'name': 'mark'}, param2={'$set':{'let': 10}})
#await delete_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'cash': 10})

#--------------------------------------------------------------------------------------------------------------------------------------------------------

#     Название базы данных и колекции

DatabaseName = 'pondb2'
CollectionName = 'poncoll2'


#--------------------------------------------------------------------------------------------------------------------------------------------------------

async def test():

	db = await find_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'name': 'mark'})
	print(db)

	if not db:
		print('занесение')

		return await insert_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'name':'mark'})

	try: cash = db['cash']
	except: cash = None

	await delete_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param={'cash': 10})

	if not cash:
		print('update data')
		return await update_data(url=url.uri, DatabaseName=DatabaseName, CollectionName=CollectionName, param1={'name':'mark'}, param2={'$set':{'cash': 10}})

	print(cash)

asyncio.run(test())

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

masedb-1.1.8.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file masedb-1.1.8.tar.gz.

File metadata

  • Download URL: masedb-1.1.8.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.4

File hashes

Hashes for masedb-1.1.8.tar.gz
Algorithm Hash digest
SHA256 22ac6c2c08ccbb8ef2da88bd2dea956547838335a395452f6ecd9fbc0f3fa86c
MD5 fb6546852b03e766d79e42d1194116e2
BLAKE2b-256 7aca7256c67feff9a6eade23b53ac825e05c6f9c183f6463e103ffe12213de39

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