Skip to content

Commit 2876fdf

Browse files
committed
Switch back to PostgreSQL
1 parent cfa7f17 commit 2876fdf

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ To see it in action:
88
```
99
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=password postgres
1010
```
11+
1112
2. Start example with:
1213
```
1314
git clone https://github.com/FerretDB/embedded-example.git
@@ -19,19 +20,20 @@ go run main.go
1920

2021
```
2122
$ mongosh
22-
Current Mongosh Log ID: 642b78c47cc3d068be6a3032
23-
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.8.0
24-
Using MongoDB: 6.0.42
25-
Using Mongosh: 1.8.0
23+
Current Mongosh Log ID: 66a36fe425b4669aac9f9769
24+
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.12
25+
Using MongoDB: 7.0.42
26+
Using Mongosh: 2.2.12
2627
2728
For mongosh info see: https://docs.mongodb.com/mongodb-shell/
2829
2930
------
3031
The server generated these startup warnings when booting
31-
2023-04-04T01:09:24.993Z: Powered by FerretDB unknown and PostgreSQL 15.2.
32-
2023-04-04T01:09:24.993Z: Please star us on GitHub: https://github.com/FerretDB/FerretDB.
32+
2024-07-26T09:44:04.726Z: Powered by FerretDB unknown and PostgreSQL 16.3.
33+
2024-07-26T09:44:04.726Z: Please star us on GitHub: https://github.com/FerretDB/FerretDB.
3334
------
3435
3536
test> db.test.find()
36-
[ { _id: ObjectId("642b78be03eb5aed54f767bc"), hello: 'world' } ]
37+
[ { _id: ObjectId('66a36fdbf693bdd9d33739e8'), hello: 'world' } ]
38+
test>
3739
```

data/.gitkeep

Whitespace-only changes.

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ func main() {
5050
Listener: ferretdb.ListenerConfig{
5151
TCP: "127.0.0.1:27017",
5252
},
53-
Handler: "sqlite",
54-
SQLiteURL: "file:data/",
53+
Handler: "postgresql",
54+
PostgreSQLURL: "postgres://postgres:password@127.0.0.1:5432/postgres",
5555
})
5656
if err != nil {
5757
log.Fatal(err)
5858
}
5959

6060
ctx, cancel := context.WithCancel(context.Background())
61+
defer cancel()
62+
6163
done := make(chan error)
6264

6365
go func() {
@@ -69,7 +71,8 @@ func main() {
6971

7072
runExampleClient(uri)
7173

72-
cancel()
74+
// cancel()
75+
7376
err = <-done
7477
if err != nil {
7578
log.Fatal(err)

0 commit comments

Comments
 (0)