Emulates MongoDB's Wire Protocol on top of SAP HANA. This way SAP HANA can be used as a drop-in replacement for MongoDB, which reduces migration efforts and enables legacy applications to run on SAP HANA's JSON Document Store.
APACHE-2.0 License
SAP HANA compatibility layer for MongoDB Wire Protocol is in the process of becoming a viable drop-in replacement for MongoDB using SAP HANA JSON Document Store as the storage engine. It allows the use of basic CRUD operations with mongosh or any MongoDB driver. SAP HANA compatibility layer for MongoDB Wire Protocol is a fork from FerretDB (ferretdb.io), an open-source alternative to MongoDB. Please see the following for an overview of supported MongoDB commands and supported datatypes.
This project is a working prototype that comes without warranty. It is not recommended nor intended to be used productively.
mongosh
or any MongoDB driverTLS
is supportedCRUD
operationsCRUD
operationsNULL
, it will count as unset when $not
is used on the field. This results in the condition of the filter being true
instead of false
like it would be within MongoDB. This is the case when for instance using $elemMatch
.show dbs
, the sizes are not the sizes on disk as it would be in MongoDB. Instead it is the size used in memory when the collections of the database are loaded. Any unloaded collection will therefore result in 0 bytes.TEST
cannot be used as a name for a database.If further differences are found, please report this to a project maintainer.
sudo
)sudo
)For the installation of Go-hdb see the following links:
Please note it will not work with the go-hdb found here: https://github.com/SAP/go-hdb. It must be the official Go driver used in the above mentioned links.
Clone the repository and enter the project folder sap-hana-compatibility-layer-for-mongodb-wire-protocol
In the project folder sap-hana-compatibility-layer-for-mongodb-wire-protocol
run the following:
make init
It will install all dependencies needed to run SAP HANA compatibility layer for MongoDB Wire Protocol.
In terminal window 1 run:
docker-compose up
If sudo
is required, use:
sudo docker-compose up
In terminal window 2 run:
make run HANAConnectString=<please-insert-connect-string-here>
Depending on the shell used, it might be necessary to put the connect string between quotation marks "". An exmaple of a connection string is: hdb://User1:Password1@999deec0-ccb7-4a5e-b317-d419e19be648.hana.prod-us10.hanacloud.ondemand.com:443
.
and now in terminal window 3, run the following after making sure the previous two steps started successfully:
make mongosh DB=<please-insert-database-name-here>
DB
is the database name in MongoDB and the schema name in SAP HANA JSON Document Store. If the given database name is not found as a schema in SAP HANA JSON Document Store, a new schema will be created when a collection is created. If no value for DB is given, then it will be set to DB_NAME
.
If permission is denied because the rights of sudo
are needed, run:
make mongosh-sudo DB=<please-insert-databse-name-here>
mongosh
:db.createCollection("firstCollection")
db.firstCollection.insertOne({we: "did", it: "!"})
db.firstCollection.find()
To use TLS see: Setup TLS
This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Copyright (2022-)2022 SAP SE or an SAP affiliate company and sap-hana-compatibility-layer-for-mongodb-wire-protocol contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.