Skip to content

Commit 8796558

Browse files
committed
fixed docs
1 parent d6be304 commit 8796558

File tree

6 files changed

+23
-14
lines changed

6 files changed

+23
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ db.collection('users').aggregate([
133133
## Installation
134134

135135
```bash
136-
npm install queryleaf
136+
npm install @queryleaf/lib
137137
```
138138

139139
## Usage
140140

141141
QueryLeaf takes your existing MongoDB client. It never creates or manages MongoDB connections on its own.
142142

143143
```typescript
144-
import { QueryLeaf } from 'queryleaf';
144+
import { QueryLeaf } from '@queryleaf/lib';
145145
import { MongoClient } from 'mongodb';
146146

147147
// Your existing MongoDB client
@@ -165,7 +165,7 @@ await mongoClient.close();
165165
For testing or debugging without a real database, use DummyQueryLeaf:
166166

167167
```typescript
168-
import { DummyQueryLeaf } from 'queryleaf';
168+
import { DummyQueryLeaf } from '@queryleaf/lib';
169169

170170
// Create a DummyQueryLeaf instance for testing
171171
const queryLeaf = new DummyQueryLeaf('mydatabase');

docs/debugging/troubleshooting.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ This guide provides solutions for common issues you may encounter when using Que
2222
**Example:**
2323

2424
```typescript
25+
// Import from @queryleaf/lib instead of queryleaf
26+
import { DummyQueryLeaf } from '@queryleaf/lib';
27+
2528
// Use DummyQueryLeaf to debug
2629
const dummy = new DummyQueryLeaf('debug_db');
2730
try {
@@ -219,6 +222,9 @@ function log(message) {
219222
Examine the MongoDB commands being generated:
220223

221224
```typescript
225+
// Import from @queryleaf/lib
226+
import { DummyQueryLeaf } from '@queryleaf/lib';
227+
222228
// Using DummyQueryLeaf
223229
const dummy = new DummyQueryLeaf('debug_db');
224230
console.log('Translating SQL to MongoDB commands...');
@@ -415,6 +421,9 @@ SELECT name, COALESCE(email, 'No Email') as contact FROM users
415421
For complex GROUP BY operations:
416422

417423
```typescript
424+
// Import from @queryleaf/lib
425+
import { DummyQueryLeaf } from '@queryleaf/lib';
426+
418427
// Break down the aggregation into stages
419428
const dummy = new DummyQueryLeaf('debug_db');
420429

docs/getting-started/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Here's a basic project setup with QueryLeaf:
107107

108108
3. Install QueryLeaf and MongoDB client:
109109
```bash
110-
npm install queryleaf mongodb
110+
npm install @queryleaf/lib mongodb
111111
```
112112

113113
4. Create a basic file structure:
@@ -123,7 +123,7 @@ Here's a basic project setup with QueryLeaf:
123123
5. Add a basic usage example in `src/index.js`:
124124
```javascript
125125
const { MongoClient } = require('mongodb');
126-
const { QueryLeaf } = require('queryleaf');
126+
const { QueryLeaf } = require('@queryleaf/lib');
127127

128128
async function main() {
129129
// Connect to MongoDB

docs/getting-started/quickstart.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Here's a simple example showing how to use QueryLeaf with an existing MongoDB cl
88

99
```typescript
1010
import { MongoClient } from 'mongodb';
11-
import { QueryLeaf } from 'queryleaf';
11+
import { QueryLeaf } from '@queryleaf/lib';
1212

1313
async function runQueries() {
1414
// Connect to MongoDB
@@ -60,7 +60,7 @@ QueryLeaf is written in TypeScript and provides full type definitions. Here's ho
6060

6161
```typescript
6262
import { MongoClient } from 'mongodb';
63-
import { QueryLeaf } from 'queryleaf';
63+
import { QueryLeaf } from '@queryleaf/lib';
6464

6565
interface User {
6666
_id: string;
@@ -97,7 +97,7 @@ getUsers()
9797
For testing or development without a real MongoDB instance, you can use the `DummyQueryLeaf` class:
9898

9999
```typescript
100-
import { DummyQueryLeaf } from 'queryleaf';
100+
import { DummyQueryLeaf } from '@queryleaf/lib';
101101

102102
async function testQueries() {
103103
// Create a dummy client that logs operations without executing them

docs/usage/dummy-client.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This guide explains how to use the dummy client effectively.
1414
The `DummyQueryLeaf` class mimics the real `QueryLeaf` but logs operations instead of executing them:
1515

1616
```typescript
17-
import { DummyQueryLeaf } from 'queryleaf';
17+
import { DummyQueryLeaf } from '@queryleaf/lib';
1818

1919
// Create a dummy client (no MongoDB client required)
2020
const dummyLeaf = new DummyQueryLeaf('mydb');
@@ -30,7 +30,7 @@ await dummyLeaf.execute('SELECT name, email FROM users WHERE age > 21');
3030
The dummy client is particularly useful for understanding how SQL queries are translated to MongoDB commands:
3131

3232
```typescript
33-
import { DummyQueryLeaf } from 'queryleaf';
33+
import { DummyQueryLeaf } from '@queryleaf/lib';
3434

3535
async function debugSqlTranslation() {
3636
const dummyLeaf = new DummyQueryLeaf('testdb');
@@ -66,7 +66,7 @@ This will output detailed logs showing how each SQL query is translated to Mongo
6666
The dummy client is especially useful in unit tests where you want to verify that your application generates the correct SQL queries without actually executing them:
6767

6868
```typescript
69-
import { DummyQueryLeaf } from 'queryleaf';
69+
import { DummyQueryLeaf } from '@queryleaf/lib';
7070

7171
// Mock console.log to capture output
7272
let consoleOutput: string[] = [];
@@ -126,7 +126,7 @@ This means it validates that your SQL syntax is correct and shows how it would b
126126
You can extend the `DummyQueryLeaf` class for custom testing scenarios:
127127

128128
```typescript
129-
import { DummyQueryLeaf, Command } from 'queryleaf';
129+
import { DummyQueryLeaf, Command } from '@queryleaf/lib';
130130

131131
class TestingQueryLeaf extends DummyQueryLeaf {
132132
public commands: Command[] = [];

docs/usage/mongodb-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Here's a complete example with proper connection management:
6767

6868
```typescript
6969
import { MongoClient } from 'mongodb';
70-
import { QueryLeaf } from 'queryleaf';
70+
import { QueryLeaf } from '@queryleaf/lib';
7171

7272
async function main() {
7373
const client = new MongoClient('mongodb://localhost:27017');
@@ -177,7 +177,7 @@ Implement proper error handling for MongoDB connection issues:
177177

178178
```typescript
179179
import { MongoClient, MongoServerError } from 'mongodb';
180-
import { QueryLeaf } from 'queryleaf';
180+
import { QueryLeaf } from '@queryleaf/lib';
181181

182182
async function executeWithRetry(sqlQuery: string, maxRetries = 3) {
183183
const client = new MongoClient('mongodb://localhost:27017');

0 commit comments

Comments
 (0)