Mongo-java-driver dependency (JAVA)

Hi. I’ve seen many examples in which ‘mongo-java-driver’ (and also mongodb-driver-core, bson) is used instead of our mongodb-driver-sync.
(I’m talking about pom.xml file dependencies.)
How is our dependency(sync) different from another?
Thanks!

1 Like

Hi @Victor_69915,

Are the examples you referring to in this course material ?

This dependency is our uber driver that combines the legacy driver, the mongodb-driver and bson. You do not need to use this one for the course.

Given that we started with this uber approach at the beginning, it is natural that a great deal of examples and tutorials available still use this dependency.
The mongodb-driver-sync is a recent artifact.

Since version 3.7 we’ve decided to produce a much leaner set of drivers, that are focussed in the development model that you may be using, either sync or async, therefore our mongodb-driver-sync.
With this approach, we achieve a much more straight forward set of objects and remove any extra code implementation, that combines the sync and async models, when in most cases you want one or another, rarely both combined.

If you do have systems/applications that use both sync and async models, you can always use the mongo-java-driver.

Yes, we use the sync driver since we are not using any java async functionality for this course.

You should not need to change anything in your POM file.

N.

2 Likes

Thanks!

No, sorry. I just saw it in other examples.

So, after some time, this driver will be deprecated?

Not necessarily.
Again, there are cases where you do want to use both async and sync functions in your code, therefore this might be useful.

What is important is that if you are using a sync only programing model, or just async, you should use one of this leaner drivers.

Makes sense?

N.

1 Like

Sure. Now it is clear :wink: