MongoDB ist eine dokumentenorientierte NoSQL-Datenbank, die Daten als BSON-Dokumente (Binary JSON) speichert. Die Unit implementiert das MongoDB Wire Protocol direkt über TCP — ohne externe Treiberbibliothek. Unterstützt werden Verbindungsaufbau, Authentifizierung (PLAIN, SCRAM-SHA-1), Dokument-Erstellung im BSON-Format und alle relevanten Op-Codes (Query, Insert, Update, Delete, Msg).
Einsatzbereiche sind Anwendungen mit flexiblem, schemalosem Datenspeicher — typisch für Logging, Kataloge, Content-Management, Zeitreihendaten und Konfigurationsspeicher.
| Name | Typ | Wert | Sichtbarkeit |
|---|---|---|---|
MONGO_PORT | int64 | 27017 | pub |
BSON_DOUBLE | int64 | 1 | pub |
BSON_STRING | int64 | 2 | pub |
BSON_DOCUMENT | int64 | 3 | pub |
BSON_ARRAY | int64 | 4 | pub |
BSON_BINARY | int64 | 5 | pub |
BSON_UNDEFINED | int64 | 6 | pub |
BSON_OBJECTID | int64 | 7 | pub |
BSON_BOOL | int64 | 8 | pub |
BSON_NULL | int64 | 9 | pub |
BSON_INT32 | int64 | 16 | pub |
BSON_TIMESTAMP | int64 | 17 | pub |
BSON_INT64 | int64 | 18 | pub |
BSON_MINKEY | int64 | 255 | pub |
BSON_MAXKEY | int64 | 127 | pub |
MONGO_OP_REPLY | int64 | 1 | pub |
MONGO_OP_MSG | int64 | 1000 | pub |
MONGO_OP_UPDATE | int64 | 2001 | pub |
MONGO_OP_INSERT | int64 | 2002 | pub |
MONGO_OP_QUERY | int64 | 2004 | pub |
MONGO_OP_GET_MORE | int64 | 2005 | pub |
MONGO_OP_DELETE | int64 | 2006 | pub |
MONGO_OP_KILL_CURSORS | int64 | 2007 | pub |
MONGO_AUTH_PLAIN | int64 | 0 | pub |
MONGO_AUTH_SCRAM_SHA1 | int64 | 1 | pub |
| Feld | Typ |
|---|---|
host | int64 |
port | int64 |
count | int64 |
max | int64 |
| Feld | Typ |
|---|
| Signatur | Sichtbarkeit | Beschreibung |
|---|---|---|
MongoConnect(host: int64, port: int64): MongoConn | pub | Öffnet TCP-Verbindung zu MongoDB |
MongoDisconnect(conn: MongoConn): void | pub | Trennt MongoDB-Verbindung |
MongoIsConnected(conn: MongoConn): bool | pub | Prüft ob Verbindung aktiv ist |
| Feld | Typ |
|---|
| Signatur | Sichtbarkeit | Beschreibung |
|---|---|---|
MongoDocNew(): MongoDoc | pub | Erstellt leeres BSON-Dokument |
MongoDocAddString(doc: MongoDoc, key: int64, value: int64): int64 | pub | Fügt String-Feld in BSON-Dokument ein |
MongoSend(conn: MongoConn, data: int64, len: int64): int64 | pub | Sendet Wire-Protocol-Daten an MongoDB |
MongoRead(conn: MongoConn, data: int64, len: int64): int64 | pub | Empfängt Wire-Protocol-Daten von MongoDB |
MongoCollectionName(db: int64, coll: int64): int64 | pub | Erzeugt vollständigen Collection-Bezeichner |