MongoDB & Node.js: Create an ACID Transaction (Part 3 of 4)

preview_player
Показать описание


Chapters:
00:00 Intro
01:06 ACID transactions in MongoDB
04:06 The Setup
05:19 Create a Transaction
05:43 Create a Helper Function
07:50 Create a Function for the Transaction
17:59 Call the Function
20:54 Wrapping Up

Other videos in this tutorial series:

Links Lauren mentions in the video:

Connect with Lauren:

Connect with MongoDB:
Рекомендации по теме
Комментарии
Автор

Super awesome and straightforward explanation! Great work👍

roaring_cannon
Автор

Transactions are needed to avoid concurrent modification related issues like read skew, phantom read, lost updates etc. Single threaded applications or where two transactions are accessible not-shared data are not prone to these errors, hence won't benefit from transactional overhead. We see a Single threaded usage of a transactions in the example which particularly does not solve any problems. Would you like to shed some light on what kinds of transaction Isolation it is using or we have options to use in Mongo. It would be really helpful to understand the transactional guarantees Mongo dB currently provides.

ayanSaha
Автор

well it would be easier just to do
reservation = {
...reservation,
...reservationDetails,
}

ajengmaharriza
Автор

Absolutely Awesome video infinite ❤️❤️❤️...

upendrasingh
Автор

I realy enjoyed first two tutorials, but this one definitely did not feel like quick start video. The example was so complicated, that for me, someone completely new to MongoDB, i got so lost in the complexity of the example, that i barely grasped how transactions work. Just replicating code without having any clue what i was doing. I would much prefer very simple example focused more on explaining how everything works for a "quick start" series. Previous videos were great tho and easy to understand.

sylveredge
Автор

inside catch always use console.error, to send message to correct stream

ajengmaharriza
Автор

How would one go about maintaining a transaction for nested function calls? Like say for example a function A has some code in it and also calls function B. Now we can use session.withTransaction() in function A, but how do we use this same transaction for the database operations in function B? Do we pass the session variable as an argument to function B and use it in there?

weinschelbarretto
Автор

i have a few questions no 1: what is the difference between $push and $addToSet array operator? couldn't we use $push instead?

noorulamin
Автор

I get an error: The transaction was aborted due to an unexpected error: MongoServerError: The dollar ($) prefixed field '$date' in 'datesReserved.0.$date' is not valid for storage.

jaggyjut
Автор

The session details are stored at the application level. What happens if the application server crashes mid-transaction?

adityadalal
Автор

I think the meaning of transaction is not described here?
Is it editing two tables (collections) in one function? Why is it need to be emphasized that it is supported, isn't it common to be able to edit / work on multible tables?

yogiHalim
Автор

2: in current case datesReserved is an array of only dates right? suppose if this array was a Subdocument we know the $in operator won't work . So in such situation which operator would we use to find a particular sub document in a collection ?

noorulamin
Автор

If I extended a schema with a custom method, which is usually a part of an outer transaction, is it a safe practice to pass session parameter to that method?

aram
Автор

3: can we use $each operator to add an object to a subdocument?

noorulamin
Автор

I am new and I have a question @13:04
Author uses “datesReserved:{$in: reservationDates}”

According to documentation the $in operator will look for documents where “value of a field equals any value in the specified array”.
If datesReserved=[<Date1>, <Date2>], reservationDates=[<rDate1>, <rDate2>] and <Date1> < <rDate1> < <Date2> < <rDate2> then I would think we still have double book problem but the check is still OK

Another word does $in operator (1)checks for the range of time or it (2)checks for the individual time value of the conditional array? I would think (2) is the case according to the above documentation definition?

thanghwang
Автор

is the procedure for converting standalon mogodb to replica set same if i am using mongodb as a service ?

siddharthsvnit
Автор

Why do you need Node.js? Can't it be done in terminal?

withpikachu
Автор

Amazing tutorials. Also you have, like, super duper nice teeth lol

warlax