BREAKING CHANGE(tsmdb): rename CongoDB to TsmDB and relocate/rename wire-protocol server implementation and public exports
This commit is contained in:
@@ -9,21 +9,21 @@
|
||||
- **Why:** Deno wraps CommonJS exports in a `default` property, so default imports are required
|
||||
- Fixed in version 2.0.13 (changed from `import * as mongoPlugin`)
|
||||
|
||||
## CongoDB - MongoDB Wire Protocol Server
|
||||
## TsmDB - MongoDB Wire Protocol Server
|
||||
|
||||
### Architecture
|
||||
CongoDB implements the MongoDB binary wire protocol (OP_MSG, OP_QUERY) allowing official MongoDB drivers to connect directly.
|
||||
TsmDB implements the MongoDB binary wire protocol (OP_MSG, OP_QUERY) allowing official MongoDB drivers to connect directly.
|
||||
|
||||
```
|
||||
Official MongoClient → TCP (wire protocol) → CongoServer → Engines → Storage
|
||||
Official MongoClient → TCP (wire protocol) → TsmdbServer → Engines → Storage
|
||||
(mongodb npm) OP_MSG/BSON (port)
|
||||
```
|
||||
|
||||
### Module Structure
|
||||
```
|
||||
ts/congodb/
|
||||
ts/tsmdb/
|
||||
├── server/ # Wire protocol server
|
||||
│ ├── CongoServer.ts # TCP server, connection handling
|
||||
│ ├── TsmdbServer.ts # TCP server, connection handling
|
||||
│ ├── WireProtocol.ts # OP_MSG/OP_QUERY parsing & encoding
|
||||
│ ├── CommandRouter.ts # Route commands to handlers
|
||||
│ └── handlers/ # Command implementations
|
||||
@@ -53,11 +53,11 @@ ts/congodb/
|
||||
|
||||
### Usage Example
|
||||
```typescript
|
||||
import { CongoServer } from '@push.rocks/smartmongo/congodb';
|
||||
import { TsmdbServer } from '@push.rocks/smartmongo/tsmdb';
|
||||
import { MongoClient } from 'mongodb';
|
||||
|
||||
// Start server
|
||||
const server = new CongoServer({ port: 27117 });
|
||||
const server = new TsmdbServer({ port: 27117 });
|
||||
await server.start();
|
||||
|
||||
// Connect with official MongoDB driver
|
||||
@@ -82,8 +82,3 @@ await server.stop();
|
||||
- **Aggregation**: aggregate, count, distinct
|
||||
- **Indexes**: createIndexes, dropIndexes, listIndexes
|
||||
- **Admin**: ping, listDatabases, listCollections, drop, dropDatabase, create, serverStatus, buildInfo
|
||||
|
||||
### Notes
|
||||
- The old CongoClient/CongoDb/CongoCollection classes have been removed
|
||||
- Use the official `mongodb` npm package's MongoClient instead
|
||||
- Server supports MongoDB wire protocol versions 0-21 (MongoDB 3.6 through 7.0 compatible)
|
||||
|
||||
Reference in New Issue
Block a user