Skip to content

Commit db85750

Browse files
authored
Merge pull request #69 from MongoCamp/jdbc-driver
Jdbc driver
2 parents d3be4e4 + 51aa927 commit db85750

File tree

96 files changed

+6294
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+6294
-623
lines changed

.github/workflows/main_test_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
mongodb-version: ['4.4', '5.0', '6.0', '7.0']
17-
java: [ '11', '17' ]
17+
java: [ '21', '23' ]
1818
steps:
1919
- uses: actions/checkout@main
2020
- name: Setup TimeZone

.github/workflows/other_test.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
mongodb-version: ['4.4', '5.0', '6.0', '7.0']
17-
java: [ '11', '17' ]
16+
mongodb-version: [ '4.4', '5.0', '6.0', '7.0' ]
17+
java: [ '21', '23' ]
1818
steps:
19-
- uses: actions/checkout@main
20-
- name: Set up JDK ${{ matrix.Java }}
21-
uses: coursier/setup-action@main
22-
with:
23-
jvm: corretto:${{ matrix.Java }}
24-
apps: sbt scala scalac
25-
- name: Setup TimeZone
26-
uses: MathRobin/timezone-action@v1.1
27-
with:
28-
timezoneLinux: "Europe/Berlin"
29-
timezoneMacos: "Europe/Berlin"
30-
timezoneWindows: "W. Europe Standard Time"
31-
- name: Start MongoDB ${{ matrix.mongodb-version }}
32-
uses: MongoCamp/mongodb-github-action@main
33-
with:
34-
mongodb-version: ${{ matrix.mongodb-version }}
35-
- name: Run tests
36-
run: |
37-
timedatectl
38-
sbt +test
19+
- uses: actions/checkout@main
20+
- name: Set up JDK ${{ matrix.Java }}
21+
uses: coursier/setup-action@main
22+
with:
23+
jvm: corretto:${{ matrix.Java }}
24+
apps: sbt scala scalac
25+
- name: Setup TimeZone
26+
uses: MathRobin/timezone-action@v1.1
27+
with:
28+
timezoneLinux: "Europe/Berlin"
29+
timezoneMacos: "Europe/Berlin"
30+
timezoneWindows: "W. Europe Standard Time"
31+
- name: Start MongoDB ${{ matrix.mongodb-version }}
32+
uses: MongoCamp/mongodb-github-action@main
33+
with:
34+
mongodb-version: ${{ matrix.mongodb-version }}
35+
- name: Run tests
36+
run: |
37+
timedatectl
38+
sbt +test

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ class RestaurantDemoSpec extends Specification with RestaurantDemoDatabaseFuncti
158158

159159
## Run Tests
160160
```shell
161-
docker run --publish 27017:27017 mongocamp/mongodb:latest;
162-
sbt test;
161+
docker run -d --publish 27017:27017 --name mongodb mongocamp/mongodb:latest;
162+
sbt test;
163+
docker rm -f mongodb;
163164
```
164165

165166
## Supporters

build.sbt

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ developers := List(
4040

4141
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
4242

43-
crossScalaVersions := Seq("2.13.13", "2.12.17")
43+
crossScalaVersions := Seq("2.13.15", "2.12.20")
4444

4545
scalaVersion := crossScalaVersions.value.head
4646

@@ -61,41 +61,48 @@ resolvers += "Sonatype OSS Snapshots".at("https://oss.sonatype.org/content/repos
6161

6262
// Test
6363

64-
libraryDependencies += "org.specs2" %% "specs2-core" % "4.20.5" % Test
64+
libraryDependencies += "org.specs2" %% "specs2-core" % "4.20.9" % Test
6565

66-
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.5.0" % Test
66+
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.5.11" % Test
6767

68-
libraryDependencies += "joda-time" % "joda-time" % "2.12.7" % Test
68+
libraryDependencies += "joda-time" % "joda-time" % "2.13.0"
6969

70-
val circeVersion = "0.14.6"
70+
val circeVersion = "0.14.10"
7171

7272
libraryDependencies ++= Seq(
7373
"io.circe" %% "circe-core",
7474
"io.circe" %% "circe-generic",
7575
"io.circe" %% "circe-parser"
76-
).map(_ % circeVersion % Test)
76+
).map(_ % circeVersion)
7777

78-
libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "4.11.1"
78+
libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "5.1.4"
7979

80-
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.10.5" % Provided
80+
// MongoDB 5.2.0 not supported for de.bwaldvogel -> https://github.com/bwaldvogel/mongo-java-server/issues/233
81+
val MongoJavaServerVersion = "1.45.0"
8182

82-
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.5.5-11" % Provided
83+
libraryDependencies += "de.bwaldvogel" % "mongo-java-server" % MongoJavaServerVersion % Provided
8384

84-
libraryDependencies += "org.apache.lucene" % "lucene-queryparser" % "9.10.0"
85+
libraryDependencies += "de.bwaldvogel" % "mongo-java-server-h2-backend" % MongoJavaServerVersion % Provided
8586

86-
val MongoJavaServerVersion = "1.44.0"
87+
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.10.7" % Provided
8788

88-
libraryDependencies += "de.bwaldvogel" % "mongo-java-server" % MongoJavaServerVersion % Provided
89+
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.5.6-6" % Provided
8990

90-
libraryDependencies += "de.bwaldvogel" % "mongo-java-server-h2-backend" % MongoJavaServerVersion % Provided
91+
libraryDependencies += "org.apache.lucene" % "lucene-queryparser" % "10.0.0"
9192

9293
libraryDependencies += "com.github.pathikrit" %% "better-files" % "3.9.2"
9394

9495
libraryDependencies += "com.typesafe" % "config" % "1.4.3"
9596

9697
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5"
9798

98-
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0"
99+
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0"
100+
101+
libraryDependencies += "com.vdurmont" % "semver4j" % "3.1.0"
102+
103+
libraryDependencies += "com.github.jsqlparser" % "jsqlparser" % "5.0"
104+
105+
libraryDependencies += "org.liquibase" % "liquibase-core" % "4.29.2" % Test
99106

100107
buildInfoPackage := "dev.mongocamp.driver.mongodb"
101108

build_release.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import sbtrelease.ReleasePlugin.runtimeVersion
66

77
import scala.sys.process.*
88

9+
releaseVersionBump := sbtrelease.Version.Bump.NextStable
10+
911
val gitAddAllTask = ReleaseStep(action = st => {
1012
"git add .".!
1113
st

changelog/config.js

Lines changed: 0 additions & 95 deletions
This file was deleted.

changelog/header.hbs

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/.vitepress/config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ function nav() {
6060
{text: 'MongoDAO', link: '/documentation/mongo-dao/'},
6161
{text: 'GridFsDAO', link: '/documentation/gridfs-dao/'},
6262
{text: 'Collection', link: '/documentation/collection/'},
63-
{text: 'LocalServer', link: '/documentation/local-server'}
63+
{text: 'LocalServer', link: '/documentation/local-server'},
64+
{text: 'SQL', link: '/documentation/sql'}
6465
]
6566
},
6667
{
@@ -128,9 +129,18 @@ function sidebarDocumentation() {
128129
items: [
129130
{text: 'Introduction', link: '/documentation/collection/'},
130131
{text: 'Aggregation', link: '/documentation/collection/aggregation'},
131-
{text: 'Pagination', link: '/documentation/collection/pagination'}
132+
{text: 'Pagination', link: '/documentation/collection/pagination'},
133+
{text: 'Schema analyse', link: '/documentation/collection/analyse-schema'},
132134
]
133135
},
136+
{
137+
text: 'SQL', items: [
138+
{text: 'Query Holder', link: '/documentation/sql/queryholder'},
139+
{text: 'JDBC driver', link: '/documentation/sql/jdbc-driver'},
140+
],
141+
collapsible: true,
142+
collapsed: true,
143+
},
134144
{
135145
text: 'LocalServer',
136146
link: '/documentation/local-server'
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Analyse Schema
2+
The driver supports an automated detection of the schema of an existing collection. The schema is used to detect the types of the columns.
3+
4+
## Usage
5+
6+
### Schema Analysis
7+
Analyse a collection to detect the values for each field and the percentage distribution of the types.
8+
9+
<<< @/../src/test/scala/dev/mongocamp/driver/mongodb/schema/SchemaSpec.scala#schema-analysis
10+
11+
### Detect Schema
12+
The Schema Detector can be used to detect the schema of a collection and is based on [Schema Anaysis](analyse-schema.md#schema-analysis). The schema is used to detect the types of the columns and generate a [JSON Schema](https://json-schema.org) for the collection. In case of multiple types of a field the Generation of the JSON Schema use the type with the most elements.
13+
14+
:::tip
15+
The [JSON Schema](https://json-schema.org) format can be use to validate or generate data, as well to secure your [Mongo Collection](https://www.mongodb.com/docs/manual/core/schema-validation/).
16+
:::
17+
18+
<<< @/../src/test/scala/dev/mongocamp/driver/mongodb/schema/SchemaSpec.scala#schema-explorer

docs/documentation/sql/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SQL Support
2+
3+
Since Version 2.7.1 the driver supports [SQL queries](queryholder.md) on MongoDB. The SQL queries are converted to MongoDB queries and could executed on the MongoDB database.
4+
5+
The driver also supports a [JDBC driver](jdbc-driver.md) to use the SQL queries in your application and migrate your database with liquibase for example.

0 commit comments

Comments
 (0)