mongodb with Java (Spring) & its JavaScript client

Installation and data base set up

- got the tar.gz extracted and moved to a new directory. Then ran on one terminal :

 ./mongod -v -auth

-v is for verbose, -vv is for more verbose!
On another terminal used for client :

./mongo
// implied : rest of the commands are in the JavaScript shell
> use admin
> db.addUser("admusr", "jd-password-a93")

Needed to authenticate this user and continue, I exited the shell, you might be able to continue like this:



> db.auth("admtfw", "jd-jv_2s7B1")

> db.addUser("tushar", "alp-27jfO6")
{
	"user" : "tushar",
	"readOnly" : false,
	"pwd" : "sdkk3934jfjkejfjfe073fje83jf",
	"_id" : ObjectId("520fb59266cbdc22ec84f78d")
}

Now to the Java Code, first the POM entries, worked with Spring and MongoDb Java driver directly



2.11.2
	


	
		
			mysql
			mysql-connector-java
			${mysql.driver.version}
		
		
		
			org.springframework.data
			spring-data-mongodb
			1.2.1.RELEASE
		



		
			spring-release
			Spring Maven Release Repository
			http://repo.springsource.org/libs-release
		

		
			springsource-repo
			SpringSource Repository
			http://repo.springsource.org/release
		

Comments

idea telecom services case no DL20139/14 in delhi district court.

44341967909