Skip to content

Commit 582cbce

Browse files
authored
Merge pull request #68 from MongoCamp/master
Master
2 parents 8b792a7 + 737f17c commit 582cbce

File tree

12 files changed

+95
-22
lines changed

12 files changed

+95
-22
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: [ '11', '17', '21' ]
1818
steps:
1919
- uses: actions/[email protected]
2020
- name: Setup TimeZone

.github/workflows/other_test.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: [ '11', '17', '21' ]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Set up JDK ${{ matrix.Java }}

.github/workflows/release_and_changelog.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,35 @@ jobs:
2828
body: ${{ steps.changelog.outputs.changes }}
2929
token: ${{ github.token }}
3030

31+
- name: Update versions file
32+
run: |
33+
echo "{\"mongocamp\": \"${{ github.ref_name }}\"}" > ./docs/versions.json;
34+
git add ./docs/versions.json
35+
3136
- name: Commit CHANGELOG.md
3237
uses: stefanzweifel/git-auto-commit-action@v4
3338
with:
3439
branch: main
3540
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }}'
36-
file_pattern: CHANGELOG.md
41+
file_pattern: CHANGELOG.md
42+
43+
- name: Set up JDK
44+
uses: coursier/setup-action@v1
45+
with:
46+
jvm: graalvm-java17:22.3.3
47+
apps: sbt scala scalac
48+
49+
- name: Install pnpm
50+
uses: pnpm/[email protected]
51+
with:
52+
version: 6.0.2
53+
54+
- name: Build and deploy Docu
55+
env:
56+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
GITHUB_USER: ${{ github.actor }}
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
run: |
60+
git config --global user.email "[email protected]"
61+
git config --global user.name "MongoCamp CI"
62+
sh ./deploy_ghpages.sh

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ libraryDependencies += "org.mongodb.scala" %% "mongo-scala-driver" % "4.11.0"
7979

8080
libraryDependencies += "org.xerial.snappy" % "snappy-java" % "1.1.10.5" % Provided
8181

82-
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.5.5-6" % Provided
82+
libraryDependencies += "com.github.luben" % "zstd-jni" % "1.5.5-10" % Provided
8383

8484
libraryDependencies += "org.apache.lucene" % "lucene-queryparser" % "9.8.0"
8585

docs/.vitepress/config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Unocss from 'unocss/vite'
22
import {defineConfig} from 'vitepress'
3-
import {version} from '../../package.json'
4-
import {SearchPlugin} from 'vitepress-plugin-search'
3+
import fs from 'fs'
54

65
export default defineConfig({
76
lang: 'en-US',
@@ -50,6 +49,8 @@ export default defineConfig({
5049
})
5150

5251
function nav() {
52+
var versionInfos = JSON.parse(fs.readFileSync('docs/versions.json', 'utf-8'))
53+
5354
return [
5455
{
5556
text: 'Documentation',
@@ -63,7 +64,7 @@ function nav() {
6364
]
6465
},
6566
{
66-
text: version,
67+
text: versionInfos.mongocamp,
6768
items: [
6869
{
6970
text: 'Changelog',

docs/versions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"mongocamp": "2.6.6"}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name" : "mongodb-driver",
33
"organization" : "dev.mongocamp",
4-
"version" : "2.6.6.snapshot",
4+
"version" : "2.6.7.snapshot",
55
"author" : "[email protected]",
66
"license" : "Apache-2.0",
77
"repository" : {
88
"type" : "git",
99
"url" : "git+https://github.com/MongoCamp/mongodb-driver.git"
1010
},
1111
"bugs" : {
12-
"url" : "https://github.com/MongoCamp/mongocamp-driver/issues"
12+
"url" : "https://github.com/MongoCamp/mongodb-driver/issues"
1313
},
1414
"homepage" : "https://mongodb-driver.mongocamp.dev/",
1515
"scripts" : {

project/plugins.sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
22

3-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
3+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
44

5-
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.7")
5+
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
66

77
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
88

@@ -13,13 +13,13 @@ addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
1313
addSbtPlugin("com.github.fedragon" % "sbt-todolist" % "0.7")
1414

1515
// Release
16-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.18")
16+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
1717

1818
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1")
1919

2020
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
2121

22-
addSbtPlugin("dev.quadstingray" %% "sbt-json" % "0.6.3")
22+
addSbtPlugin("dev.quadstingray" %% "sbt-json" % "0.6.5")
2323

2424
addDependencyTreePlugin
2525

scalastyle-config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
</check>
8686
<check level="warning" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true">
8787
<parameters>
88-
<parameter name="maximum"><![CDATA[30]]></parameter>
88+
<parameter name="maximum"><![CDATA[35]]></parameter>
8989
</parameters>
9090
</check>
9191
<check level="warning" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"></check>

src/main/scala/dev/mongocamp/driver/mongodb/bson/BsonConverter.scala

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import java.math.BigInteger
88
import java.time.{ LocalDate, LocalDateTime, ZoneId }
99
import java.util.Date
1010
import scala.collection.mutable
11+
import scala.concurrent.duration.Duration
1112
import scala.jdk.CollectionConverters._
1213
import scala.util.matching.Regex
1314

@@ -22,7 +23,7 @@ object BsonConverter {
2223

2324
def lastKeyFromRelation(key: String): String = key.substring(key.lastIndexOf(DocumentKeyDivider) + 1)
2425

25-
def documentValueOption(document: Document, key: String): Option[Any] =
26+
def documentValueOption(document: Document, key: String): Option[Any] = {
2627
if (hasRelation(key)) {
2728
val newKey = newKeyFromRelation(key)
2829
val relation = relationKey(key)
@@ -36,13 +37,17 @@ object BsonConverter {
3637
None
3738
}
3839
}
39-
else
40+
else {
4041
None
42+
}
4143
}
42-
else if (document.contains(key))
44+
else if (document.contains(key)) {
4345
Some(fromBson(document(key)))
44-
else
46+
}
47+
else {
4548
None
49+
}
50+
}
4651

4752
def updateDocumentValue(document: Document, key: String, value: Any): Document = {
4853
val doc = org.mongodb.scala.bson.collection.mutable.Document(document.toJson())
@@ -110,6 +115,7 @@ object BsonConverter {
110115
case bytes: Array[Byte] => BsonBinary(bytes)
111116
case r: Regex => BsonRegularExpression(r)
112117
case d: Date => BsonDateTime(d)
118+
case d: Duration => BsonString(d.toString)
113119
case ld: LocalDate =>
114120
BsonDateTime(Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant))
115121
case ldt: LocalDateTime =>

0 commit comments

Comments
 (0)