Skip to content

Instantly share code, notes, and snippets.

View alexbjorlig's full-sized avatar

Alex Bjørlig alexbjorlig

View GitHub Profile
@alexbjorlig
alexbjorlig / mongo-transaction-playground.ts
Created January 7, 2020 20:19
Example of bulk write transaction with Mongo 4.0 in Node.js
import { Backend } from '../../db/connection';
import { MongoClient, Db } from 'mongodb';
import { setupCliEnv } from './setup-cli-env';
export async function mongoTransactionTest() {
setupCliEnv('development', false);
const options = {
useNewUrlParser: true,
useUnifiedTopology: true,