Package: nevermined-metadata-driver-mongodb
metadata-driver-mongodb🐳Mongo DBdriver for MetadataDB (Python).nevermined.ioTable of ContentsFeaturesPrerequisitesQuickstartEnvironment variablesCode styleTestingNew VersionLicenseFeaturesMongoDB driver to connect implementing MetatadaDB.PrerequisitesYou should have running a mongo instance.QuickstartFirst 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/configIf 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[metadatadb]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 HTTPdb.verify_certs=False# If True, CA certificate will be verifieddb.ca_cert_path=# If verifyCerts is True, then path to the CA cert should be provided heredb.client_key=# If db server needs client verification, then provide path to your client keydb.client_cert_path=# If db server needs client verification, then provide path to your client certificatedb.username=user# If you are using authentication, mongodb username.db.password=password# If you are using authentication, mongodb password.db.name=test# Mongodb database namedb.collection=col# Mongodb collection nameOnce you have defined this the only thing that you have to do it is use it:metadatadb=MetadataDb(conf)metadatadb.write({"value":"test"},id)Environment variablesWhen you want to instantiate an Metadatadb plugin you can provide the next environment variables:$CONFIG_PATH$MODULE$DB_HOSTNAME$DB_PORT$DB_NAME$DB_COLLECTION$DB_USERNAME$DB_PASSWORDQueriesCurrently we are supporting a list of queries predefined in order to improve the search:
All this queries present a common format:query:{"name":[args]}This queries are the following:priceCould receive one or two parameters. If you only pass one assumes that your query is going to start from 0 to your value.Next query:query:{"price":[0,10]}It is transformed to:{"service.metadata.base.price":{"$gt": 0, "$lt": 10}}licenseIt is going to retrieve all the documents with license that you are passing in the parameters,
if you do not pass any value retrieve all.{"license":["Public domain", "CC-YB"]}typeIt is going to check that the following service types are included in the ddo.{"type":["Access", "Metadata"]}sampleCheck that the metadata include a sample that contains a link of type sample. Do not take parameters.{"sample":[]}categoriesRetrieve all the values that contain one of the specifies categories.{"categories":["weather", "meteorology"]}createdRetrieve all the values that has been created after a specified date.
The parameters available are 'today', 'lastWeek', 'lastMonth', 'lastYear'. If you pass more than one take the bigger interval.
If you do not pass any parameter retrieve everything.{"created":["today"]}updatedFrequencyRetrieve all the values that contain one of the specifies updated frecuencies.{"updatedFrequency":["monthly"]}textRetrieve all the values that match with the text sent.{"text":["weather"]}TestingAutomatic tests are setup via Github actions.
Our test use pytest framework.New VersionThebumpversion.shscript helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.LicenseCopyright 2020 Keyko GmbH
This product includes software developed at
BigchainDB GmbH and Ocean Protocol (https://www.oceanprotocol.com/)

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.