Access NO-SQL Mongo DB with Java

Last updated: 2025-09-14

Pre-Requisites:

  1. Have your MongoDB installed and running

Steps:

  1. Create Maven project with the following pom.xml:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-nosql-mongo-tutorial.adoc - include::inc/mongo/pom.xml[]

If you are using Eclipse, be sure to refresh your project (select your project→ right click→ Maven→ Update Project)

  1. Create config file at src/main/resources/config.properties with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-nosql-mongo-tutorial.adoc - include::inc/mongo/src/main/resources/config.properties[]
  1. Create Model Account with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-nosql-mongo-tutorial.adoc - include::inc/mongo/src/main/java/com/app/Account.java[]
  1. Create Main class with the following contents:

Unresolved include directive in modules/6.x.x/pages/frameworks/jk-framework/jk-framework-data/java-simple-nosql-mongo-tutorial.adoc - include::inc/mongo/src/main/java/com/app/App.java[]

Thats it, now run your App class.

Output

Full example source-code can be found at https://github.com/smartapi-com/j-framework-data-nosql-mongo