Java MongoDB Tutorial
MongoDB, noSQL open source database, written in C++, with many great features like map-reduce , auto sharding, replication, high availability and etc.
The following Java / Spring Data MongoDB tutorials and examples are tested with :
- MongoDB 2.2.3
- Java-MongoDB-Driver 2.11.0
- Spring-Data-MongoDB 1.2.0.RELEASE
1. MongoDB Core Examples
MongoDB installation, configuration, connect, query and backup.
Install MongoDB on Windows
How to install MongoDB on Windows.
Install MongoDB on Ubuntu
How to install MongoDB on Ubuntu.
Install MongoDB on Mac OS X
How to install MongoDB on Mac OS X.
MongoDB Hello World Example
How to do CRUD and indexing in MongoDB.
MongoDB authentication example
Start MongoDB in secure mode, authentication is required.
MongoDB import and export example
Backup with mongoexport, restore with mongoimport in MongoDB.
2. Java MongoDB Examples
Java MongoDB driver APIs examples to perform insert, update, query and delete documents from MongoDB.
Java MongoDB hello world example
Classic hello world example to show you how to use Java MongoDB driver APIs to perform CRUD in MongoDB.
Java MongoDB : Authentication Example
Example to perform authentication access to MongoDB.
Java MongoDB : Insert a document
4 ways to insert JSON data into MongoDB.
Java MongoDB : Update document
Example to use collection.update() to update an existing document
Java MongoDB : Query document
Example to use collection.find() to get / query document from collection.
Java MongoDB : Delete document
Example to use collection.remove() to delete documents from collection.
Java MongoDB : Save image example
Use GridFS APIs to save binary file into MongoDB.
3. Spring Data MongoDB Examples
Spring Data for MongoDB examples to perform insert, update, query and delete documents from MongoDB.
Spring Data MongoDB hello world example
Configure (both XML and annotation) and perform CRUD operations with “Spring Data for MongoDB” framework.
Spring Data MongoDB : Insert document
Example to use Spring data save() and insert() to save domain object into MongoDB database.
Spring Data MongoDB : Update document
Example to use Spring data save(), updateFirst() and updateMulti() to update existing domain object from MongoDB database.
Spring Data MongoDB : Query document
Example to use Spring data findOne(), find() and getCollection() to get / query documents from MongoDB.
Spring Data MongoDB : Delete document
Example to remove() and findAndRemove() to delete documents from MongoDB.
Spring Data MongoDB : Save binary file, GridFS example
Use GridFS in Spring Data MongoDB, to save the binary file in MongoDB.
Spring Data MongoDB – Auto Sequence ID Example
How to create an auto increase sequence id.
4. MongoDB FAQs
Some common questions and answers in MongoDB.
- Repair a crashed MongoDB server
- Couldn’t Open /Data/Db/Yourdb.Ns Errno:13 Permission Denied
- Java MongoDB : Convert JSON data to DBObject
- Java MongoDB : Get collection from database
- Spring Data MongoDB Remove _class Column