Last active
August 8, 2022 22:47
-
-
Save kertpjatkin/77056571b05a3ad891a30f4740e418c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function main() { | |
| await client.connect(); | |
| const db = client.db(dbName); | |
| const collection = db.collection('testCollection'); | |
| const session = client.startSession({ causalConsistency: true }); | |
| const newDocument = await collection.insertOne({}, { session, writeConcern: { w: "majority" } }); | |
| const foundDocument = await collection.findOne( | |
| {_id: newDocument.insertedId}, | |
| { session, readConcern: "majority" } | |
| ); | |
| console.log(foundDocument); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment