A python package for connecting with database.
Project description
# mongo_operations: MongoDB Operations Simplified
mongo_operations is a Python package designed to simplify common MongoDB operations. It provides an easy-to-use interface for interacting with MongoDB databases and collections. Whether you are inserting records, reading data, updating records, or performing bulk inserts, mongo_operations streamlines the process, making MongoDB operations straightforward.
# Installation
Install the package using pip:
pip install PSKConnect==0.0.2
# Usage
## Create an Instance of mongo_operation
from mayyaDatabase import mongo_crud
Provide your MongoDB client URL and database name mongo_op = mongo_crud.mongo_operation(client_url=’your_mongo_client_url’,database_name=’your_database_name’)
## Create a DataBase
Provide the name for your MongoDB collection database = mongo_op.create_database()
## Create a Collection
Provide the name for your MongoDB collection collection = mongo_op.create_collection(collection_name=’your_collection_name’)
## Insert Records
Insert a single record record = {‘key’: ‘value’} mongo_op.insert_record(record=record, collection_name=’your_collection_name’)
Insert multiple records records = [{‘key1’: ‘value1’}, {‘key2’: ‘value2’}] mongo_op.insert_record(record=records, collection_name=’your_collection_name’)
## Read Records
Read all records from the collection mongo_op.read_record(collection_name=’your_collection_name’)
## Delete Records
Provide a query to match records to be deleted query = {‘key’: ‘value’} mongo_op.delete_record(record=query, collection_name=’your_collection_name’)
## Update Records
Provide a query to match records to be updated and an update document query = {‘key’: ‘value’} update = {‘$set’: {‘new_key’: ‘new_value’}} mongo_op.update_record(query=query, update=update, collection_name=’your_collection_name’)
## Bulk Insert from Data File
Provide the path to your data file (CSV or Excel) data_file_path = ‘path/to/your/datafile.csv’ mongo_op.bulk_insert(datafile=data_file_path, collection_name=’your_collection_name’)
## Contributors
### SAIKIRANPATNANA
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PSKConnect-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 818ee36902773936787ac71ef233536eaf9b2ac5a71e956a35d8973dd1c1e853 |
|
MD5 | a8c615949f3e1dd9be14efd0c9254b80 |
|
BLAKE2b-256 | 0f3c6c396cfed17f2251799d2556fef66cb2e4fb756c4eacb16db88f715fa140 |