jagi / meteor-astronomy

Model layer for Meteor
https://atmospherejs.com/jagi/astronomy
MIT License
604 stars 67 forks source link

Support for mongo transactions #707

Open boomfly opened 5 years ago

boomfly commented 5 years ago

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();
}
diavrank commented 3 years ago

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

lukejagodzinski commented 3 years ago

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).