#How to use MongoDB in java?

28 messages · Page 1 of 1 (latest)

hexed eagle
#

How do I use MongoDB in java ??

olive frostBOT
#

This post has been reserved for your question.

Hey @hexed eagle! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

unreal thunder
#
  1. Set up MongoDB somewhere
  2. Add MongoDB driver to your project as a dependency
  3. Create MongoDB client in your application
  4. Connect to MongoDB
  5. Issue commands you want with MongoDB client
#

This is a really easy to google question with tons of examples out there. I suggest you to search for a tutorial and just follow along either from youtube or blog whatever you prefer more and get back with a more concrete question if something does not work the way you expect.

hexed eagle
#

how to add as dependency (step 2)

dry phoenix
#

Depends on your project setup

#

Are you using maven or gradle or smth else

hexed eagle
#

i use intellij's build

onyx ivy
hexed eagle
#

it doesnt have mongodb

dry phoenix
hexed eagle
#

HOWW!!??

#

THATS WHAT IM ASKING

dry phoenix
#

imp sent the wrong like by mistake, but it's quite literally above the remove section

hexed eagle
#

where should i get the depend3encies of mongo

dry phoenix
#

They should have a download link somewhere

#

Like imp I do recommend using Maven or Gradle instead of using Artifacts

hexed eagle
#

they dont

#

i found everywhere

#

oh

dry phoenix
#

It's in the maven repo if you need it

onyx ivy
#

but this jar is likely to have other dependencies so it might not work if you just add that jar

#

(hence my recommendation to use a depmgmt system)

#

yeah it has dependencies on slf4j (optional), bson and mongodb-driver-core:

dry phoenix
#

Yeah