https://github.com/shashankrnr32/mongodb-application-sharding
Application Sharding with MongoDB
https://github.com/shashankrnr32/mongodb-application-sharding
application-sharding database java mongodb nosql sharding sharding-jdbc sharding-sphere shardingsphere spring spring-boot
Last synced: 7 months ago
JSON representation
Application Sharding with MongoDB
- Host: GitHub
- URL: https://github.com/shashankrnr32/mongodb-application-sharding
- Owner: shashankrnr32
- License: mit
- Created: 2023-03-31T13:36:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-19T16:13:17.000Z (over 2 years ago)
- Last Synced: 2025-01-12T19:48:00.836Z (9 months ago)
- Topics: application-sharding, database, java, mongodb, nosql, sharding, sharding-jdbc, sharding-sphere, shardingsphere, spring, spring-boot
- Language: Java
- Homepage: https://shashankrnr32.gitbook.io/mongodb-application-sharding
- Size: 1.34 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# mongodb-application-sharding
[](https://github.com/shashankrnr32/mongodb-application-sharding/actions/workflows/maven.yml)
[](https://github.com/shashankrnr32/mongodb-application-sharding/actions/workflows/maven-publish.yml)
[](https://codecov.io/gh/shashankrnr32/mongodb-application-sharding)[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
Mongo DB Application Sharding allows you to shard your Mongo DB cluster from your application using different
strategies. This project is inspired by [Apache's shardingsphere](https://github.com/apache/shardingsphere) which
enables the users to shard the relational databases through the application.Application Sharding Strategies supported by the library
1. Collection Sharding Strategy
2. Database Sharding Strategy
3. Composite Sharding Strategy## Get Started
### Spring / Spring Boot Projects
To use this library in your project, just add the package `sharding-spring`
as a dependency to your project.```xml
com.alpha.mongodb
sharding-spring
${mongodb.sharding.version}```
### Mongo DB Clients - Application built without Spring.
```xml
com.alpha.mongodb
sharding-driver
${mongodb.sharding.version}```
To see a sample usage of different Sharding Strategies, visit the documentation
[here](https://shashankrnr32.gitbook.io/mongodb-application-sharding).## Features
1. Supports 3 different sharding strategies for Spring / Spring Boot projects by extending MongoTemplate.
2. Supports Reactive Mongo Templates (for all the sharding strategies)
3. Sharding support for Mongo Clients (without the need of spring dependencies). This supports both executable and
reactive Mongo Clients.
4. Hint Resolution through ThreadLocal and callback based mechanism.
5. Automatic Hint Resolution Callback discovery for Spring Beans using ApplicationContext
6. Custom configuration available for Sharding, validation of shards etc.
7. Tested using Spring's Mongo Template and Repository## Roadmap
This project is in its budding stage. But I do see a lot of features that can be added.
1. More customization to Sharding options to allow dynamic shards, custom validations etc.
2. Support non-sharded collections within a sharded database.
3. Support to query from all the shards when the library is unable to route the query to a particular shard.
4. Configuring Sharding from property files without writing any Java Code
5. Support Aggregation queries
7. And so much more...!## Code Analysis
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)
[](https://sonarcloud.io/summary/new_code?id=shashankrnr32_mongodb-application-sharding)## Author
[Shashank Sharma](https://github.com/shashankrnr32)