10gen: M101J MongoDB for Java Developers – Week 2

M101J

This class has been going great.

The flow of the class is great and it’s worked well on Windows with Eclipse, Maven and JDK 1.6.

Some notes and links:

BSON
document oriented database
The Spark web framework for Java is nice, very small and simple.

 

MongoClient client = new MongoClient();
DB db = client.getDB(“school”);
DBCollection people = db.getCollection(“people”);

 

Hibernate OGM – MongoDB vs Kundera vs Jongo vs MongoDB API vs Morphia vs Spring Data Mongo – MongoDB Drivers for Java

I am working on a Spring MVC app that demonstrates all of the different MongoDB Java APIs.

Some Links
http://code.google.com/p/morphia/wiki/QuickStart

http://www.mongodb.org/display/DOCS/Java+Tutorial

http://jongo.org/#updating

https://github.com/hibernate/hibernate-ogm

https://openshift.redhat.com/community/blogs/configuring-hibernateogm-for-your-jboss-app-using-mongodb-on-openshift-paas

http://www.hibernate.org/subprojects/ogm.html

https://github.com/impetus-opensource/Kundera/wiki

https://github.com/impetus-opensource/Kundera/wiki/Getting-Started-in-5-minutes

http://blog.fisharefriends.us/morphia-vs-spring-data-mongodb/

http://www.ibm.com/developerworks/java/library/j-morphia/index.html

Maven POM Settings For Various Drivers

	
		morphia
		Morphia
		http://morphia.googlecode.com/svn/mavenrepo/
		default

		    sonatype-nexus
		    Kundera Public Repository
		    https://oss.sonatype.org/content/repositories/releases

			true

			false

		kundera-missing
		Kundera Public Missing Resources Repository
		http://kundera.googlecode.com/svn/maven2/maven-missing-resources

			true

			true

        com.google.code.morphia
        morphia
        0.99

        org.hibernate.ogm
        hibernate-ogm-core
        4.0.0-SNAPSHOT
        provided

	org.mongodb
	mongo-java-driver
	2.10.1

 org.springframework.data
 spring-data-mongodb
 1.0.4.RELEASE

Hibernate OGM for MongoDB
https://community.jboss.org/wiki/PortingSeamHotelBookingExampleToOGM
https://github.com/ajf8/seam-booking-ogm
https://openshift.redhat.com/community/blogs/configuring-hibernateogm-for-your-jboss-app-using-mongodb-on-openshift-paas
https://github.com/openshift/openshift-ogm-quickstart

Kundera (JPA for MongoDB)
https://github.com/impetus-opensource/Kundera-Examples/wiki/Using-Kundera-with-Spring
https://github.com/impetus-opensource/Kundera
https://github.com/impetus-opensource/kundera-mongo-performance
https://github.com/impetus-opensource/Kundera-Examples
https://github.com/impetus-opensource/Kundera/wiki/Sample-Codes-and-Examples
https://github.com/impetus-opensource/Kundera-Examples/wiki/Twitter
http://architects.dzone.com/articles/sqlifying-nosql-%E2%80%93-are-orm
https://github.com/xamry/twitample
https://github.com/impetus-opensource/Kundera-Examples/wiki/Cross-datastore-persistence-using-Kundera
http://prabhubuzz.wordpress.com/2012/05/25/mongodb-cassandra-jpa-service-using-kundera/
http://gora.apache.org/
http://xamry.wordpress.com/2011/05/02/working-with-mongodb-using-kundera/
https://github.com/impetus-opensource/Kundera/wiki/Getting-Started-in-5-minutes
https://github.com/impetus-opensource/Kundera/wiki/Concepts

sj:mug Holiday Mongo Talks

MongoDB @ HP in Mt Laurel, NJ

 

 

My local demo is hitting a MongoDB instance at MongoLab, the provide free hosting for a small dataset.

 

I have a simple application based on Spring Data for Mongodb.

 

MongoOperations mongoOps = null;
 AppConfig config = new AppConfig();
 try {
 mongoOps = config.mongoTemplate();
 } catch (Exception e) {
 e.printStackTrace();
 logger.error("Mongo Connection Error", e);
 }

 Person person = mongoOps.findOne(new Query(where("name").is("Joe")), Person.class);
 logger.info(person.toString());

 model.addAttribute("MongoInfo", person.toString());

 

august 2012 – 2.2
aggregation framework
improved concurrency
mongo is great for email storage / documents
aggregation  – unix style piping
TTL (time to live)
garbage collect data
unwind an array

 

 

Nodester Node.JS + Express + Mongo App Part 1 – Nodester

The Running Node.JS Application on a Nodester

 

I am still working on putting up a full application for the tutorial.  Also I will try the same application on Nodejitsu, CloudFoundry and Heroku.

The following are the basic steps for working with Nodester. It is very similiar to all the other command-line PaaS interfaces. I am running this on
Windows, but it will work in most environments.

 

npm install nodester-cli -g
nodester user setup <username> <password>
nodester user setkey c:.sshid_rsa.pub
nodester app create <appname>
nodester app init <appname>
nodester npm install express
nodester npm install mongoose
nodester npm install socket.io

git add .
git commit -am "Ready to deploy"
git push nodester master

nodester app info
nodester app stop|start|restart
nodester app logs

For nodester they push to master for Nodester to get a new build.

Log into your Application List Page on the Administration Site for Nodester and you will see your newly added Application. Nodester has a good help system that will be useful to you while learning. The git commands are standard GIT which makes using all the cloud systems pretty similiar.

After uploading, I check the logs for errors:

nodester app logs
nodester info Showing logs for: rollerderby
New PID: 18884
chroot_runner
chroot_runner
Spawing /app/server.js
Running node v-0.8.1
:: nodester ::

App listening on port 19885

nodester info ok!

nodester deployed

 

I used there out of the box example and added a connection to my test mongo db database at MongoLab.

 

Link Section:

The final deployed application from this tutorial

http://blog.nodester.com/post/3634535277/running-websockets-on-nodester

http://blog.nodester.com/post/19902515151/tips-for-windows-users

http://blog.nodester.com/

https://github.com/nodester/nodester/wiki/

Restify with Mongodb and Mongoose (src)

Backbone.js Boilerplate

Node.JS Mongodb Native Driver

Mongoose Driver

Mongoose Tutorial

Node.JS and Mongodb Video Tutorial

Node.JS / Mongodb / Mongoose Tutorial

Finding Documents in MongoDB with Mongoose

Node.js Tutorial

Restful API with Node.js and Mongodb + Expresss & Mongoose

Backbone.js Fundamentals

Mongoose Model Definition

Toad for Cloud

TOAD for Cloud Databases

It’s free and it works great for querying your NOSQL databases.

I am using it here against a free instance of MongoDB database hosted on MongoLab.  It works great and fast and is nice for people who have been using TOAD against Oracle for years.

It also works Cassandra and Hadoop amongst others.  For free, give it a try.  There’s also an Eclipse plug-in, but that was a little too slow and memory draining for me.  They use a funky datahub for querying things and that seems to work well for me on Windows 7.

Download the Full Installation Community Edition here.

 

TOAD

TOAD

 

No, Not Python, It’s the Holy Grails…

I’ve been evaluating a few different technologies for doing some rapid web development work and recently I have been looking at the bounty of available tools, libraries, frameworks and associates of Spring.  Spring ROO and Groovy/Grails are the big two RAD tools from SpringSource and they look pretty amazing.  I don’t think I’ve found the Holy Grail of Web App development, but these two tools are really helpful in rapidly developing apps.  I am hoping someone combines Roo or Grails with Vert.x to make a really awesome alternative to Node.JS.  I like Node.JS and have been doing JavaScript for a decade, but I prefer the languages of the JVM and Vert.x’s support for multiple languages is pretty awesome.  Hmmm, Vert.x in Grails.

With the excellent STS inside Eclipse, this gives Groovy and Java a great IDE for development, testing and debugging.  And that is something that is lacking for Node.JS.  Node.JS has a few tools out there, but nothing open source, free, full of awesome mature plugins (PMD, Checkstyle, GIT, Maven, JUnit, FindBugs, …) and just plain easy to use.  Eclipse also has plugins for working with CloudFoundry, Heroku, OpenShift and other Cloud environments.

Between Grails and Roo, I really like the fact that I can remove Roo at anytime and still have a fully functionally application setup that utilizes standard Spring tools.  It’s also easier to add other cool Spring projects like Spring Social, Spring Mobile, Spring Data and more.

Both Grails and Roo support MongoDB very well and that’s great too see.  I have a few Mongo DB instances on MongoLab, MongoHQ and OpenShift.  These services all have great free developer services that are great for learning, prototyping and for tutorials.  I am really loving Heroku and OpenShift.  It’s hard to pick one, so I didn’t.  I use them both.

Vert.x + Groovy is really cool, but again not much IDE support, tools or extra libraries.  It should grow start building support now, but competition with Node.JS is pretty fierce.

Interesting, Roo vs Grails Jobs.

 

 

But if you look at just Spring (which Roo is just a tool to help with a Spring project):

 

 

There’s also some great documentation, tutorials and books on Groovy/Grails since it’s been out for a while:  http://grails.org/Tutorials  http://www.infoq.com/minibooks/grails-getting-started On the other hand, Roo is newer, but since it generates standard Spring + Java, you are really just getting a good head start on your project.

Heroku has a nice article on using both with their awesome platform:   https://devcenter.heroku.com/articles/grails  and https://devcenter.heroku.com/articles/spring-mvc-hibernate.

I will post a Github repository of some samples soon.

 

Spring MVC + Spring Data for Mongodb + Mongolab + OpenShift

I created a small tutorial application following the Spring Data for Mongodb guide with a little bacon for flavor. I wanted to use real hosting for MongoDB, so I created a database at MongoLab.   It was quick and easy and the hosting is fast and works great even remotely for local development.

The tutorial application in process is one to register your Bacon Creation for this year’s BaconFest.  The winner gets a mini BaconExplosion.

This is ONLY a test, you will not receive BACON.
image