Mango
A Simple wrapper module for Mongo sit on top of PyMongo.
Installation
To install mango lib: pip install python-mango.
Usage
To import module: import mango.
Sample:
import mango
uri = "mongodb://user:pwd@localhost:port/database"
mango.init_db(uri)
# To get database object
db = mango.mgdb
# To get table object
mytable = mango.get_table('mytable')
# Select rows
rows = mango.select('mytable')
rows = mango.select('mytable', { "qty": { "$gt": 4 } })
# Insert
mango.insert('mytable', dict(name='Aung Aung'))
# Update
_filter = dict(id=1234)
_value = dict(mark=80)
mango.update('mytable', _filter, _value)
_value = {
"$set": {
"name": "Tun Aung"
},
"$push": {
"marks": {
"english": 60
}
}
}
mango.update('mytable', _filter, _value)
# Delete
_filter = dict(id=456)
mango.delete('mytable', _filter)
Availabe functions
init_db
To initialize MongoDb Connection.
Parameter:
uri: MongoDb URI
get_table
Get the MongoDb Table object.
Parameter:
table_name: Table name
select
Query record(s) from table.
Parameters:
table_name: Table name
_filter: MongoDb filter object
is_many: Use find or find_one. Default is False which means find_one will be used.
**kwargs: KwArgs which will be pass to pymongo function
insert
Insert record(s) to table.
Parameters:
table_name: Table name
_value: Value that will be inserted
is_many: insert_one or insert_many. Default is False (means insert_one).
**kwargs: KwArgs will be pass to pymongo function
update
Update record(s) to table.
Parameters:
table_name: Table name
_filter: MongoDb filter object
_value: Value that will be updated
is_many: update_one or update_many. Default is False (means update_one).
_operation: MongoDb update operation. Default is $set.
**kwargs: KwArgs will be pass to pymongo function.
delete
Delete record(s) to table.
Parameters:
table_name: Table name
_filter: MongoDb filter object
is_many: delete_one or delete_many. Default is False (means delete_one).
**kwargs: KwArgs will be pass to pymongo function.
Metadata
Release files for python-mango 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python-mango-0.1.7.tar.gz | 3.6 kB | Without provenance | Details for python-mango-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_mango-0.1.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for python_mango-0.1.7-py2.py3-none-any.whl |
Total release size: 8.7 kB
Release files / python-mango-0.1.7.tar.gz
| Download URL | python-mango-0.1.7.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3c1f80232c2c89c13727a6f9f589f024d006c50498df92edf0659685605d94e
|
|
BLAKE2b-256 checksum How to use checksums |
8c6f9451dd287af1cd6cc623d965e1471f713a17d64119340fa775326b9e33b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python_mango-0.1.7-py2.py3-none-any.whl
| Download URL | python_mango-0.1.7-py2.py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
839ef2a65405130d866c627927c4279386ca37d7c1ec091448e26ce8ab53de24
|
|
BLAKE2b-256 checksum How to use checksums |
dfdc395ce460bbd6790eee662cc5090586f2c080b1cfbbd6ee4c74c5088acbd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-mango 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.