*This article does not dive into finer details of mongodb or document databases. that might come in another post :)
Experience and Learning Curve :
Pretty easy to get something running. Flexible. No structure implied in databases other than "collections" and "documents" concepts.
A collection is similar to a table and a document can be defined as a data row in a collection.
Once the database is created from the shell, collections (similar to tables in relational DBs) can be created when entering data itself.
Syntax is intuitive and if you've used any kind of databases , simple queries will just work on mongodb ( i tried WHERE clauses with even arrays and it worked on the first attempt. maybe sheer luck :P)
Install on Ubuntu :
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
Using mongodb with Java :
http://mvnrepository.com/artifact/org.mongodb/mongo-java-driver
The functions are almost the same as mongo shell commands. (e:g: db.customer.find() will give u all customers)
Java Objects (even arrays) can be passed straight into mongo queries. They are converted to JSON and used.
I used a set of Object Mapping(OM) classes to communicate with the db and noticed that if the OM class has an "_id" property, it is populated when passing that object as a new "document" to the db.
How to store data :
http://docs.mongodb.org/manual/MongoDB-data-models-guide.pdf
Basically , theres the two extremes in mongodb where you either can
1. associate objects using only their IDs
2. associate full objects within each other (this causes repetition, but might give u query performance)
Both patterns are used in balance in different scenarios. However, its important to not get addited towards foreign key like associations all the time if you've used relational schemas before. it should always be an objective decision.
Basic Security :
http://learnmongo.com/posts/quick-tip-mongodb-users/
http://blog.mongodirector.com/10-tips-to-improve-your-mongodb-security/
Access MongoDB in Ubuntu with authentication:
First, a user must be created and given admin privileges on the mongo server :
use orderdb
db.createUser({
user: "orderAdmin",
pwd: "hasd",
roles:[{
role: "userAdmin",
db: "orderdb"
}]
})
Then, that user must be used to open the session :
mongo --port 27017 -u hasd -p hasd --authenticationDatabase admin
This solved my confusion with how to use mongodb with the user permissions. basically , if u just use "mongo", you might not be able to do somethings u expect u can do. with the default privileges.