When we use synchronous and asynchronous driver

29 views
Skip to first unread message

Mohd rully k

unread,
Jan 16, 2018, 5:03:31 AM1/16/18
to mongodb-user
Hi everyone

I want to ask about  synchronous and asynchronous driver (java) . I've read https://stackoverflow.com/questions/41675434/should-i-use-synchronous-or-asynchronous-methods-of-c-sharp-mongodb-driver ,  but still don't get it , especially in asynchronous , where in that source he told to use when we have high complexity logic , can I have example in that ?

Sorry for newbie question 

Regards

Rully

Kevin Adistambha

unread,
Feb 6, 2018, 12:40:35 AM2/6/18
to mongodb-user

Hi Rully

The use of synchronous vs. asynchronous programming method depends entirely on your use case. There are plus and minuses in both method, but primarily, synchronous means that your program will execute from top to bottom in strict ordering (where the execution of one line will block until it’s finished). In contrast, asynchronous means that your program lines could execute out-of-order, and care must be taken to ensure the correctness of the program. As as example, Python is typically executed synchronously, while node.js is typically asynchronous (using callbacks, promises, etc.).

Unfortunately a discussion about programming model is out of scope of this group. We can help you if you’re having a specific issue with MongoDB or any of its supported drivers, but for a general programming question, StackOverflow or other general programming sites will be a more relevant forum.

Best regards
Kevin

Reply all
Reply to author
Forward
0 new messages