meteor-astronomy icon indicating copy to clipboard operation
meteor-astronomy copied to clipboard

Support for mongo transactions

Open boomfly opened this issue 5 years ago • 2 comments

Check please support for mongo transactions. Related to feature request #706

import Post from './post'
import User from './user'
import { MongoInternals } from 'meteor/mongo';

let post = Post.find(postQuery);
let user = User.find(userQuery);

post.userId = user._id;
user.posts.push(post);

const { client } = MongoInternals.defaultRemoteCollectionDriver().mongo;
const session = await client.startSession();
await session.startTransaction();
try {
  post.save({session});
  user.save({session});
  await session.commitTransaction();
} catch (e) {
  await session.abortTransaction();
} finally {
  session.endSession();
}

boomfly avatar Jul 17 '19 08:07 boomfly

This feature would be great!!! Is there any ETA for this?

diavrank avatar Nov 27 '20 19:11 diavrank

Hey, unfortunately I no longer actively develop this package. I only do bug fixes. Nowadays, there is less need for packages like this. Feel free to fork Astronomy or use custom local build with this feature merged.

Imho Meteor is not a nice option anymore, and soon it will be dead in terms of the new projects picking it as the main technology. It looks like even MDG focused their full power on Apollo. At work, I've stopped using Meteor a few years ago and I don't regret. As application grew the reactive nature of it caused more and more trouble and I feel more comfortable creating my own stack where I control every aspect of it. Also the development of Meteor stagnated. Even the 2.0 release doesn't introduce any deal breaker changes (at least from what I know).

lukejagodzinski avatar Nov 28 '20 20:11 lukejagodzinski