Service: PostgreSQL DocumentDB - EyevinnOSC/community GitHub Wiki
PostgreSQL DocumentDB
PostgreSQL DocumentDB (serviceId ferretdb-documentdb) is a MongoDB-compatible document database built by FerretDB on top of PostgreSQL. In Eyevinn Open Source Cloud (OSC) it is a long-running service instance with up to 10 GiB of storage per instance. License: MIT. Source: FerretDB/documentdb.
What it can do
- Let applications that speak the MongoDB wire protocol store their data in PostgreSQL without running MongoDB.
- Provide document collections with BSON documents, queries, updates, deletes, indexes (including TTL) and aggregation pipelines through the DocumentDB API.
- Fit into workflows that already use PostgreSQL while adding document-oriented capabilities.
Creating an instance
There are no dependencies. Store the PostgreSQL password as a service secret with create-service-secret (serviceId: "ferretdb-documentdb", for example name documentdbpwd), then call create-service-instance with serviceId: "ferretdb-documentdb":
{
"name": "mydocdb",
"PostgresPassword": "{{secrets.documentdbpwd}}"
}
Verify with wait-for-service-ready or describe-service-instance, which also shows the address and port to connect to. With the OSC CLI:
osc create ferretdb-documentdb mydocdb -o PostgresPassword="{{secrets.documentdbpwd}}"
Options
| Option | Required | Type | Meaning |
|---|---|---|---|
| name | Yes | string | Name of the instance. Alphanumeric/word characters only (^\w+$), at most 20 characters. |
| PostgresPassword | Yes | string, sensitive | Password for the underlying PostgreSQL. Pass as {{secrets.NAME}}; a reference must be the whole field value. |
| InitdbSql | No | string | SQL that runs when the database is first initialized. |
Using the instance
Use the address and port from describe-service-instance to build a MongoDB connection string. See the FerretDB documentation for the authentication settings that apply to the image.
const { MongoClient } = require('mongodb');
const client = new MongoClient(process.env.DOCUMENTDB_URL);
await client.connect();
const items = client.db('mydb').collection('items');
await items.insertOne({ hello: 'world' });
Limitations
- Storage is limited to 10 GiB per instance.