Skip to content

Commit 2acddeb

Browse files
committed
Rephrased Readme to put explicit syntax as first
1 parent b8002c3 commit 2acddeb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ npm install @event-driven-io/pongo
1212

1313
## Example
1414

15-
You can use MongoDB compliant syntax:
15+
You can use Pongo syntax with explicit typing about supported syntax:
1616

1717
```ts
18-
import { MongoClient } from "@event-driven-io/pongo";
18+
import { pongoClient } from "@event-driven-io/pongo";
1919
import { v4 as uuid } from "uuid";
2020

2121
type User = { name: string; age: number };
2222

2323
const connectionString =
2424
"postgresql://dbuser:[email protected]:3211/mydb";
2525

26-
const pongoClient = new MongoClient(postgresConnectionString);
26+
const pongoClient = pongoClient(postgresConnectionString);
2727
const pongoDb = pongoClient.db();
2828

2929
const users = pongoDb.collection<User>("users");
@@ -48,21 +48,21 @@ await pongoCollection.deleteOne({ _id: cruella._id });
4848
const anitaFromDb = await pongoCollection.findOne({ _id: anitaId });
4949

5050
// Finding more
51-
const users = await pongoCollection.find({ age: { $lt: 40 } }).toArray();
51+
const users = await pongoCollection.find({ age: { $lt: 40 } });
5252
```
5353

54-
Or a bit simpler Pongo syntax with explicit typing about supported syntax:
54+
Or use MongoDB compliant shim:
5555

5656
```ts
57-
import { pongoClient } from "@event-driven-io/pongo";
57+
import { MongoClient } from "@event-driven-io/pongo";
5858
import { v4 as uuid } from "uuid";
5959

6060
type User = { name: string; age: number };
6161

6262
const connectionString =
6363
"postgresql://dbuser:[email protected]:3211/mydb";
6464

65-
const pongoClient = pongoClient(postgresConnectionString);
65+
const pongoClient = new MongoClient(postgresConnectionString);
6666
const pongoDb = pongoClient.db();
6767

6868
const users = pongoDb.collection<User>("users");
@@ -87,7 +87,7 @@ await pongoCollection.deleteOne({ _id: cruella._id });
8787
const anitaFromDb = await pongoCollection.findOne({ _id: anitaId });
8888

8989
// Finding more
90-
const users = await pongoCollection.find({ age: { $lt: 40 } });
90+
const users = await pongoCollection.find({ age: { $lt: 40 } }).toArray();
9191
```
9292

9393
## Is it production ready?

0 commit comments

Comments
 (0)