linxus fs fixes
This commit is contained in:
parent
ac23b70146
commit
0b7846fe67
292 changed files with 41947 additions and 41947 deletions
|
|
@ -1,72 +1,72 @@
|
|||
# MongoDB Client Library
|
||||
|
||||
A comprehensive MongoDB client library for the Stock Bot trading platform, designed for handling document storage, raw data, and unstructured content.
|
||||
|
||||
## Features
|
||||
|
||||
- **Connection Management**: Robust connection pooling and failover
|
||||
- **Schema Validation**: Built-in validation using Zod schemas
|
||||
- **Type Safety**: Full TypeScript support with typed collections
|
||||
- **Error Handling**: Comprehensive error handling and retry logic
|
||||
- **Health Monitoring**: Connection health monitoring and metrics
|
||||
- **Transactions**: Support for multi-document transactions
|
||||
- **Aggregation**: Helper methods for complex aggregation pipelines
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { MongoDBClient } from '@stock-bot/mongodb-client';
|
||||
|
||||
// Initialize client
|
||||
const mongoClient = new MongoDBClient();
|
||||
await mongoClient.connect();
|
||||
|
||||
// Get a typed collection
|
||||
const collection = mongoClient.getCollection('sentiment_data');
|
||||
|
||||
// Insert document
|
||||
await collection.insertOne({
|
||||
symbol: 'AAPL',
|
||||
sentiment: 'positive',
|
||||
source: 'reddit',
|
||||
timestamp: new Date()
|
||||
});
|
||||
|
||||
// Query with aggregation
|
||||
const results = await collection.aggregate([
|
||||
{ $match: { symbol: 'AAPL' } },
|
||||
{ $group: { _id: '$sentiment', count: { $sum: 1 } } }
|
||||
]);
|
||||
```
|
||||
|
||||
## Collections
|
||||
|
||||
The client provides typed access to the following collections:
|
||||
|
||||
- **sentiment_data**: Social media sentiment analysis
|
||||
- **raw_documents**: Unprocessed documents and content
|
||||
- **news_articles**: Financial news and articles
|
||||
- **sec_filings**: SEC filing documents
|
||||
- **earnings_transcripts**: Earnings call transcripts
|
||||
- **analyst_reports**: Research reports and analysis
|
||||
|
||||
## Configuration
|
||||
|
||||
Configure using environment variables:
|
||||
|
||||
```env
|
||||
MONGODB_HOST=localhost
|
||||
MONGODB_PORT=27017
|
||||
MONGODB_DATABASE=trading_documents
|
||||
MONGODB_USERNAME=trading_admin
|
||||
MONGODB_PASSWORD=your_password
|
||||
```
|
||||
|
||||
## Health Monitoring
|
||||
|
||||
The client includes built-in health monitoring:
|
||||
|
||||
```typescript
|
||||
const health = await mongoClient.getHealth();
|
||||
console.log(health.status); // 'healthy' | 'degraded' | 'unhealthy'
|
||||
```
|
||||
# MongoDB Client Library
|
||||
|
||||
A comprehensive MongoDB client library for the Stock Bot trading platform, designed for handling document storage, raw data, and unstructured content.
|
||||
|
||||
## Features
|
||||
|
||||
- **Connection Management**: Robust connection pooling and failover
|
||||
- **Schema Validation**: Built-in validation using Zod schemas
|
||||
- **Type Safety**: Full TypeScript support with typed collections
|
||||
- **Error Handling**: Comprehensive error handling and retry logic
|
||||
- **Health Monitoring**: Connection health monitoring and metrics
|
||||
- **Transactions**: Support for multi-document transactions
|
||||
- **Aggregation**: Helper methods for complex aggregation pipelines
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
import { MongoDBClient } from '@stock-bot/mongodb-client';
|
||||
|
||||
// Initialize client
|
||||
const mongoClient = new MongoDBClient();
|
||||
await mongoClient.connect();
|
||||
|
||||
// Get a typed collection
|
||||
const collection = mongoClient.getCollection('sentiment_data');
|
||||
|
||||
// Insert document
|
||||
await collection.insertOne({
|
||||
symbol: 'AAPL',
|
||||
sentiment: 'positive',
|
||||
source: 'reddit',
|
||||
timestamp: new Date()
|
||||
});
|
||||
|
||||
// Query with aggregation
|
||||
const results = await collection.aggregate([
|
||||
{ $match: { symbol: 'AAPL' } },
|
||||
{ $group: { _id: '$sentiment', count: { $sum: 1 } } }
|
||||
]);
|
||||
```
|
||||
|
||||
## Collections
|
||||
|
||||
The client provides typed access to the following collections:
|
||||
|
||||
- **sentiment_data**: Social media sentiment analysis
|
||||
- **raw_documents**: Unprocessed documents and content
|
||||
- **news_articles**: Financial news and articles
|
||||
- **sec_filings**: SEC filing documents
|
||||
- **earnings_transcripts**: Earnings call transcripts
|
||||
- **analyst_reports**: Research reports and analysis
|
||||
|
||||
## Configuration
|
||||
|
||||
Configure using environment variables:
|
||||
|
||||
```env
|
||||
MONGODB_HOST=localhost
|
||||
MONGODB_PORT=27017
|
||||
MONGODB_DATABASE=trading_documents
|
||||
MONGODB_USERNAME=trading_admin
|
||||
MONGODB_PASSWORD=your_password
|
||||
```
|
||||
|
||||
## Health Monitoring
|
||||
|
||||
The client includes built-in health monitoring:
|
||||
|
||||
```typescript
|
||||
const health = await mongoClient.getHealth();
|
||||
console.log(health.status); // 'healthy' | 'degraded' | 'unhealthy'
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue