docs/Databases/MongoDB-Compatibility-Guide.md
This guide documents MongoDB compatibility issues and fixes for Wekan across MongoDB versions 3.0 through 8.0, ensuring proper operation with Meteor.js 2.14.
.count() MethodIssue: The .count() method is deprecated in newer MongoDB versions.
Fixed Files:
models/users.js - Line 1839server/migrations.js - Line 209server/publications/cards.js - Lines 709, 711, 713client/components/settings/adminReports.js - Line 115Fix Applied:
// Before (deprecated)
const count = collection.find().count();
// After (compatible)
const count = collection.find().countDocuments();
Issue: MongoDB 8.0 changed behavior where equality matches to null no longer match undefined values.
Fixed Files:
models/customFields.js - Custom field initializationmodels/cards.js - Card custom field initializationFix Applied:
// Before (MongoDB 8.0 incompatible)
{ field: null }
// After (MongoDB 8.0 compatible)
{ field: { $in: [null, undefined] } }
Direct operations (.direct.insert(), .direct.update(), .direct.remove()) are used intentionally in Wekan to:
Models:
models/wekanCreator.js - Wekan board creationmodels/trelloCreator.js - Trello importmodels/cards.js - Card operationsmodels/boards.js - Board operationsmodels/lists.js - List operationsmodels/swimlanes.js - Swimlane operationsmodels/customFields.js - Custom field operationsmodels/checklistItems.js - Checklist operationsmodels/integrations.js - Integration operationsmodels/csvCreator.js - CSV export operationsServer:
server/migrations.js - Database migrationsserver/notifications/outgoing.js - Notification operationsDirect operations bypass Meteor's security model, so they should only be used when:
Raw collections (.rawCollection()) are used for:
models/server/metrics.js - Metrics aggregationserver/migrations.js - Migration operationsRaw collections bypass all Meteor security, so they should only be used when:
| MongoDB Version | Driver | Status | Test Priority |
|---|---|---|---|
| 3.0 | mongodb3legacy | ✅ Compatible | High |
| 3.2 | mongodb3legacy | ✅ Compatible | High |
| 3.4 | mongodb3legacy | ✅ Compatible | High |
| 3.6 | mongodb3legacy | ✅ Compatible | High |
| 4.0 | mongodb4legacy | ✅ Compatible | High |
| 4.2 | mongodb4legacy | ✅ Compatible | High |
| 4.4 | mongodb4legacy | ✅ Compatible | High |
| 5.0 | mongodb5legacy | ✅ Compatible | Medium |
| 6.0 | mongodb6legacy | ✅ Compatible | Medium |
| 7.0 | mongodb7legacy | ✅ Compatible | Medium |
| 8.0 | mongodb8legacy | ✅ Compatible | High |
Basic Operations:
Advanced Operations:
Migration Operations:
Performance Testing:
The MongoDB driver system provides:
// Get connection statistics
Meteor.call('mongodb-driver-stats', (error, result) => {
console.log('Connection Stats:', result);
});
// Test connection
Meteor.call('mongodb-driver-test-connection', (error, result) => {
console.log('Connection Test:', result);
});
// Get supported versions
Meteor.call('mongodb-driver-supported-versions', (error, result) => {
console.log('Supported Versions:', result);
});
// Subscribe to monitoring
Meteor.subscribe('mongodb-driver-monitor');
// Access data in template
Template.yourTemplate.helpers({
driverStats() {
return MongoDBDriverMonitor.findOne('stats');
}
});
.limit() and .skip() for paginationConnection Failures:
Query Errors:
Performance Issues:
# Check MongoDB version
mongo --eval "db.version()"
# Check connection status
mongo --eval "db.runCommand({connectionStatus: 1})"
# Check indexes
mongo --eval "db.collection.getIndexes()"
# Check query performance
mongo --eval "db.collection.find().explain('executionStats')"
For MongoDB compatibility issues:
This MongoDB Compatibility Guide is part of Wekan and is licensed under the MIT License.