Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB 5.1+ driver compatibility #2691

Merged
merged 36 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1612785
run MongoDB tests on multiple Mongo versions
WebFreak001 Sep 22, 2022
d77e374
support MongoDB connectTimeout and socketTimeout
WebFreak001 Sep 22, 2022
738286c
support MongoDB authSource database setting
WebFreak001 Sep 22, 2022
b5286d3
start on opMsg implementation
WebFreak001 Sep 22, 2022
579294a
fixes
WebFreak001 Sep 22, 2022
0be86d9
MongoDB runCommand unification
WebFreak001 Sep 22, 2022
e408d19
support CRC
WebFreak001 Sep 22, 2022
eee21de
add assert to avoid mongo packet corruption
WebFreak001 Sep 22, 2022
99923b5
fix recvBsonDup
WebFreak001 Sep 22, 2022
31cdc55
use connect options timeouts
WebFreak001 Sep 22, 2022
0f3f5d9
fix recvBsonDup 2
WebFreak001 Sep 22, 2022
71763f0
fix unittests
WebFreak001 Sep 23, 2022
5e87e5f
use new Mongo runCommand method
WebFreak001 Sep 23, 2022
ccc17f0
fix cursor for now
WebFreak001 Sep 23, 2022
4e4b5c0
fix exception types on auth methods
WebFreak001 Sep 23, 2022
0d16042
update CRUD & Cursor API
WebFreak001 Sep 24, 2022
cbef81f
implement all MongoDB CRUD operations
WebFreak001 Sep 25, 2022
7be40c8
pass around $db everywhere
WebFreak001 Sep 25, 2022
77eb598
verbose logging in MongoDB tests
WebFreak001 Sep 25, 2022
d34d104
avoid calling wrong mongo overloads
WebFreak001 Sep 25, 2022
82dc01f
fix Bson.toString to not mix up object order
WebFreak001 Sep 25, 2022
9b8f024
debug output in broken CI test
WebFreak001 Sep 30, 2022
d7926a5
fix Mongo tests
WebFreak001 Sep 30, 2022
31d6630
add ObjectID support to Bson.toString
WebFreak001 Sep 30, 2022
b81e36e
use MongoDriverException in runCommand
WebFreak001 Sep 30, 2022
b19b8ca
add some `@safe` annotations to fix CI
WebFreak001 Sep 30, 2022
f358b66
add some scope attributes to fix CI
WebFreak001 Sep 30, 2022
04c692e
fix scoped recvBson overloads
WebFreak001 Sep 30, 2022
90e96b3
add scope attribute when there might be scope
WebFreak001 Sep 30, 2022
865e1e9
more scoping
WebFreak001 Sep 30, 2022
40d235f
Don't disconnect on all failed DB commands
WebFreak001 Sep 30, 2022
7b6ce69
CRC bits in sending MongoDB not yet implemented
WebFreak001 Sep 30, 2022
ad81de3
adjust to review
WebFreak001 Oct 19, 2022
acba1f4
use Duration everywhere
WebFreak001 Oct 19, 2022
e226cb8
raise MongoDB CI timeout minutes
WebFreak001 Oct 19, 2022
f788ebc
fix tests
WebFreak001 Oct 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongodb:
image: mongo
ports:
- 27017:27017

steps:
- uses: actions/checkout@v3
Expand All @@ -57,7 +53,7 @@ jobs:
- name: '[POSIX] Run tests'
env:
VIBED_DRIVER: vibe-core
PARTS: builds,unittests,examples,tests,mongo
PARTS: builds,unittests,examples,tests
run: |
./run-ci.sh

Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/mongo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: MongoDB Tests

on: [push, pull_request]

jobs:
main:
name: Run
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
dc: [ dmd-latest ]
mongo:
- '3.6'
- '4.0'
- '4.2'
- '4.4'
- '5.0'
- '6.0'

runs-on: ${{ matrix.os }}
timeout-minutes: 10
WebFreak001 marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v3

- name: Prepare compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}

- name: variable-mapper
uses: kanga333/[email protected]
with:
key: "${{ matrix.mongo }}"
map: |
{
"^3\\.6$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/3.6/multiverse/binary-amd64/mongodb-org-server_3.6.23_amd64.deb"},
"^4\\.0$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/4.0/multiverse/binary-amd64/mongodb-org-server_4.0.28_amd64.deb"},
"^4\\.2$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/bionic/mongodb-org/4.2/multiverse/binary-amd64/mongodb-org-server_4.2.22_amd64.deb"},
"^4\\.4$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/4.4/multiverse/binary-amd64/mongodb-org-server_4.4.16_amd64.deb"},
"^5\\.0$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.12_amd64.deb"},
"^6\\.0$": {"MONGO_URL":"https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/6.0/multiverse/binary-amd64/mongodb-org-server_6.0.1_amd64.deb"}
}

- name: 'Install MongoDB'
run: wget "$MONGO_URL" && sudo dpkg -i "$(basename "$MONGO_URL")"
- name: 'Run tests'
env:
VIBED_DRIVER: vibe-core
PARTS: mongo
run: |
./run-ci.sh
WebFreak001 marked this conversation as resolved.
Show resolved Hide resolved
42 changes: 41 additions & 1 deletion data/vibe/data/bson.d
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,47 @@ struct Bson {
*/
string toString()
const {
return toJson().toString();
auto ret = appender!string;
toString(ret);
return ret.data;
}

void toString(R)(ref R range)
const {
switch (type)
{
case Bson.Type.objectID:
range.put("ObjectID(");
range.put(get!BsonObjectID().toString());
range.put(")");
break;
case Bson.Type.object:
// keep ordering of objects
range.put("{");
bool first = true;
foreach (k, v; this.byKeyValue)
{
if (!first) range.put(",");
first = false;
range.put(Json(k).toString());
range.put(":");
v.toString(range);
}
range.put("}");
break;
case Bson.Type.array:
range.put("[");
foreach (i, v; this.byIndexValue)
{
if (i != 0) range.put(",");
v.toString(range);
}
range.put("]");
break;
default:
range.put(toJson().toString());
break;
}
}

import std.typecons : Nullable;
Expand Down
Loading