🐳 Mongo DB BigchainDB driver (Python).
Project description
[![banner](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png)](https://oceanprotocol.com)
# oceandb-mongodb-driver
> 🐳 [Mongo DB](https://www.mongodb.com/) driver for OceanDB (Python).
> [oceanprotocol.com](https://oceanprotocol.com)
[![Travis (.com)](https://img.shields.io/travis/com/oceanprotocol/oceandb-mongodb-driver.svg)](https://travis-ci.com/oceanprotocol/oceandb-mongodb-driver)
[![Codacy coverage](https://img.shields.io/codacy/coverage/6b8d544ca5064cfeb00e679b265f5ac9.svg)](https://app.codacy.com/project/ocean-protocol/oceandb-mongodb-driver/dashboard)
[![PyPI](https://img.shields.io/pypi/v/oceandb-mongodb-driver.svg)](https://pypi.org/project/oceandb-mongodb-driver/)
[![GitHub contributors](https://img.shields.io/github/contributors/oceanprotocol/oceandb-mongodb-driver.svg)](https://github.com/oceanprotocol/oceandb-mongodb-driver/graphs/contributors)
---
## Table of Contents
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Quickstart](#quickstart)
- [Environment variables](#environment-variables)
- [Code style](#code-style)
- [Testing](#testing)
- [New Version](#new-version)
- [License](#license)
---
## Features
MongoDB driver to connect implementing OceanDB.
## Prerequisites
You should have running a mongo instance.
## Quickstart
First of all we have to specify where is allocated our config.
To do that we have to pass the following argument:
```
--config=/path/of/my/config
```
If you do not provide a configuration path, by default the config is expected in the config folder.
In the configuration we are going to specify the following parameters to
```yaml
[oceandb]
enabled=true # In order to enable or not the plugin
module=mongodb # You can use one the plugins already created. Currently we have mongodb and bigchaindb.
module.path= # You can specify the location of your custom plugin.
db.hostname=localhost # Address of your MongoDB.
db.port=27017 # Port of your Mongodb.
db.ssl=True # If True, connections will be made using HTTPS, else using HTTP
db.verifyCerts=False # If True, CA certificate will be verified
db.caCertPath= # If verifyCerts is True, then path to the CA cert should be provided here
db.clientKey= # If db server needs client verification, then provide path to your client key
db.clientCertPath= # If db server needs client verification, then provide path to your client certificate
db.username=user # If you are using authentication, mongodb username.
db.password=password # If you are using authentication, mongodb password.
db.name=test # Mongodb database name
db.collection=col # Mongodb collection name
```
Once you have defined this the only thing that you have to do it is use it:
```python
oceandb = OceanDb(conf)
oceandb.write({"value": "test"}, id)
```
## Environment variables
When you want to instantiate an Oceandb plugin you can provide the next environment variables:
- **$CONFIG_PATH**
- **$MODULE**
- **$DB_HOSTNAME**
- **$DB_PORT**
- **$DB_NAME**
- **$DB_COLLECTION**
- **$DB_USERNAME**
- **$DB_PASSWORD**
## About queries
If you are going to do queries in mongoDB and you want to be efficient you should be aware of [create an index](https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/) for
the fields that you want to sort.
## Code style
The information about code style in python is documented in this two links [python-developer-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-developer-guide.md)
and [python-style-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-style-guide.md).
## Testing
Automatic tests are setup via Travis, executing `tox`.
Our test use pytest framework.
## New Version
The `bumpversion.sh` script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.
## License
```
Copyright 2018 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# oceandb-mongodb-driver
> 🐳 [Mongo DB](https://www.mongodb.com/) driver for OceanDB (Python).
> [oceanprotocol.com](https://oceanprotocol.com)
[![Travis (.com)](https://img.shields.io/travis/com/oceanprotocol/oceandb-mongodb-driver.svg)](https://travis-ci.com/oceanprotocol/oceandb-mongodb-driver)
[![Codacy coverage](https://img.shields.io/codacy/coverage/6b8d544ca5064cfeb00e679b265f5ac9.svg)](https://app.codacy.com/project/ocean-protocol/oceandb-mongodb-driver/dashboard)
[![PyPI](https://img.shields.io/pypi/v/oceandb-mongodb-driver.svg)](https://pypi.org/project/oceandb-mongodb-driver/)
[![GitHub contributors](https://img.shields.io/github/contributors/oceanprotocol/oceandb-mongodb-driver.svg)](https://github.com/oceanprotocol/oceandb-mongodb-driver/graphs/contributors)
---
## Table of Contents
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Quickstart](#quickstart)
- [Environment variables](#environment-variables)
- [Code style](#code-style)
- [Testing](#testing)
- [New Version](#new-version)
- [License](#license)
---
## Features
MongoDB driver to connect implementing OceanDB.
## Prerequisites
You should have running a mongo instance.
## Quickstart
First of all we have to specify where is allocated our config.
To do that we have to pass the following argument:
```
--config=/path/of/my/config
```
If you do not provide a configuration path, by default the config is expected in the config folder.
In the configuration we are going to specify the following parameters to
```yaml
[oceandb]
enabled=true # In order to enable or not the plugin
module=mongodb # You can use one the plugins already created. Currently we have mongodb and bigchaindb.
module.path= # You can specify the location of your custom plugin.
db.hostname=localhost # Address of your MongoDB.
db.port=27017 # Port of your Mongodb.
db.ssl=True # If True, connections will be made using HTTPS, else using HTTP
db.verifyCerts=False # If True, CA certificate will be verified
db.caCertPath= # If verifyCerts is True, then path to the CA cert should be provided here
db.clientKey= # If db server needs client verification, then provide path to your client key
db.clientCertPath= # If db server needs client verification, then provide path to your client certificate
db.username=user # If you are using authentication, mongodb username.
db.password=password # If you are using authentication, mongodb password.
db.name=test # Mongodb database name
db.collection=col # Mongodb collection name
```
Once you have defined this the only thing that you have to do it is use it:
```python
oceandb = OceanDb(conf)
oceandb.write({"value": "test"}, id)
```
## Environment variables
When you want to instantiate an Oceandb plugin you can provide the next environment variables:
- **$CONFIG_PATH**
- **$MODULE**
- **$DB_HOSTNAME**
- **$DB_PORT**
- **$DB_NAME**
- **$DB_COLLECTION**
- **$DB_USERNAME**
- **$DB_PASSWORD**
## About queries
If you are going to do queries in mongoDB and you want to be efficient you should be aware of [create an index](https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/) for
the fields that you want to sort.
## Code style
The information about code style in python is documented in this two links [python-developer-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-developer-guide.md)
and [python-style-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-style-guide.md).
## Testing
Automatic tests are setup via Travis, executing `tox`.
Our test use pytest framework.
## New Version
The `bumpversion.sh` script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.
## License
```
Copyright 2018 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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
Close
Hashes for oceandb-mongodb-driver-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b295b1c29fdbc651b60c4d29d1cf455f056e9f01d671316640ddc091abd6d99 |
|
MD5 | a5bea0c2eb40adcd5fbeb85854445a8a |
|
BLAKE2b-256 | c728c907618e8479f595dcf9ddc4f134d58d939ff7898da29e46d181ceeed5c7 |
Close
Hashes for oceandb_mongodb_driver-0.1.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f9e50d76e95b1e5595c20fe31d79b8c57b7014d78cfbfb50c10cec48b504171 |
|
MD5 | b4ed5968a8e9fd3fc5eb199995f5208a |
|
BLAKE2b-256 | b95bfa27334fe9ed921619f650c20ebd4f5f75b1453d17c507bc4009879b5d29 |