Skip to content

Instantly share code, notes, and snippets.

@B4nan
Created June 16, 2019 16:56
Show Gist options
  • Select an option

  • Save B4nan/2a93a5d812c7efed32be579c91e3547d to your computer and use it in GitHub Desktop.

Select an option

Save B4nan/2a93a5d812c7efed32be579c91e3547d to your computer and use it in GitHub Desktop.
More complex example of implicit transaction in MikroORM
const author = await orm.em.findOne(Author, id, ['books.tags', 'books.publisher']);
author.books[0].title = 'New book name';
author.books[0].tags[0].name = 'old';
author.books[0].tags.add(new BookTag('sale'));
author.books[0].publisher.name = 'New publisher name';
await orm.em.flush();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment