nx-mongo 3.6.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +239 -22
- package/dist/simpleMongoHelper.d.ts +68 -15
- package/dist/simpleMongoHelper.d.ts.map +1 -1
- package/dist/simpleMongoHelper.js +263 -83
- package/dist/simpleMongoHelper.js.map +1 -1
- package/package.json +1 -1
- package/src/simpleMongoHelper.ts +319 -84
- package/test-connection.ts +47 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SimpleMongoHelper } from './src/simpleMongoHelper';
|
|
2
|
+
|
|
3
|
+
async function testConnection() {
|
|
4
|
+
// Test with the connection string from the blocker report
|
|
5
|
+
const connectionString = 'mongodb://localhost:27017/';
|
|
6
|
+
const helper = new SimpleMongoHelper(connectionString);
|
|
7
|
+
|
|
8
|
+
console.log('Testing MongoDB connection...');
|
|
9
|
+
console.log(`Connection String: ${connectionString}`);
|
|
10
|
+
console.log(`Database: server`);
|
|
11
|
+
console.log('');
|
|
12
|
+
|
|
13
|
+
const result = await helper.testConnection();
|
|
14
|
+
|
|
15
|
+
if (result.success) {
|
|
16
|
+
console.log('✅ Connection test passed!');
|
|
17
|
+
console.log('You can now call helper.initialize() to establish a persistent connection.');
|
|
18
|
+
} else {
|
|
19
|
+
console.error('❌ Connection test failed!');
|
|
20
|
+
console.error('');
|
|
21
|
+
console.error('Error Type:', result.error?.type);
|
|
22
|
+
console.error('Error Message:', result.error?.message);
|
|
23
|
+
console.error('Error Details:', result.error?.details);
|
|
24
|
+
console.error('');
|
|
25
|
+
|
|
26
|
+
// Show full error object for debugging
|
|
27
|
+
console.error('Full error object:');
|
|
28
|
+
console.error(JSON.stringify(result.error, null, 2));
|
|
29
|
+
|
|
30
|
+
// Provide troubleshooting tips
|
|
31
|
+
console.error('');
|
|
32
|
+
console.error('Troubleshooting tips:');
|
|
33
|
+
if (result.error?.type === 'connection_failed') {
|
|
34
|
+
console.error(' - Try using 127.0.0.1 instead of localhost');
|
|
35
|
+
console.error(' - Verify MongoDB is running: mongosh --eval "db.version()"');
|
|
36
|
+
console.error(' - Check if MongoDB is listening on port 27017');
|
|
37
|
+
console.error(' - Check Windows Firewall settings');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Run the test
|
|
43
|
+
testConnection().catch((error) => {
|
|
44
|
+
console.error('Unexpected error:', error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
47
|
+
|