Mongo ID Marshaller
A small library that marshals Mongo ObjectIds
Install
pip install mongo_id_marshaller
Api
single()
By default, the object id key is always set to id. you can set your own key using the id_key kwarg.
from mongo_id_marshaller import MongoId
"""
mongo_data:
{
{
"_id": {$oid: "56c4b2f97c82251d12547b74"},
"longitude" : 0.81315,
"latitude" : 52.1642,
"country" : "England",
"county" : "London",
"town" : "London",
}
"""
mongo_data = db.getCollection('towns').findOne({"town": "London"})
mongo_id = MongoId()
mongo_data = mongo_id.single(mongo_data)
"""
mongo_data:
{
"id" : "56c4b2f97c82251d12547b74",
"longitude" : 0.81315,
"latitude" : 52.1642,
"country" : "England",
"county" : "London",
"town" : "London",
}
"""
multiple()
Here we are setting the id_key to _id
from mongo_id_marshaller import MongoId
"""
mongo_data:
[
{_id: {$oid: "56c4b2f97c82251d12547b74"}},
{_id: {$oid: "56c4b2f97c82251d12547b73"}}
]
"""
mongo_data = db.getCollection('towns').findOne({"town": "London"})
mongo_id = MongoId(id_key="_id")
mongo_data = mongo_id.multiple(mongo_data)
"""
mongo_data:
[
{_id: "56c4b2f97c82251d12547b74"},
{_id: "56c4b2f9s7c82251d12547b73"}
]
"""
Metadata
Release files for mongo-id-marshaller 1.0.0
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 |
|---|---|---|---|---|
| mongo-id-marshaller-1.0.0.tar.gz | 2.0 kB | Without provenance | Details for mongo-id-marshaller-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mongo_id_marshaller-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mongo_id_marshaller-1.0.0-py3-none-any.whl |
Total release size: 4.5 kB
Release files / mongo-id-marshaller-1.0.0.tar.gz
| Download URL | mongo-id-marshaller-1.0.0.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2561d6467919de5e04ecd07c82ad483dd06f69f9258a03a1ed40f1b0468b61a5
|
|
BLAKE2b-256 checksum How to use checksums |
05eb895ca1d78dbfca2be3d70ba45130b2420bd5d5195eb900df415b3b03a428
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7
|
Release files / mongo_id_marshaller-1.0.0-py3-none-any.whl
| Download URL | mongo_id_marshaller-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ac84fe1442e812818dcb88db1b8737acac19fe07fa4b1e04ba7587277513403
|
|
BLAKE2b-256 checksum How to use checksums |
5f1ac68182575d19fcabbf4be9371cca35050046e2e8698c9821ee27cd2bd177
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.7
|
Security for mongo-id-marshaller 1.0.0
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.