Driver Name: ${car.driver.name}
p. Or use properties of the inner model as part of our query strings: bc.. Car andrewCar = Car.find(byDriver.name,"Andrew").first(); h2. Mongo specific functionality h3. Mongo Information p. Models are automatically saved with a Mongo ObjectId to the specified collection. Both the ObjectId and collection name can be accessed from the model. bc.. Car myCar = new Car("Toyota", "white", 150); myCar.save(); ObjectId id = myCar.get_id(); String colName = myCar.getCollectionName(); h3. Mongo indexes p. It is possible to create indexes against your models. bc.. // index the name field of Car Car.index("onName"); // create a descending index by prepending the '-' character Car.index("on-Name"); // create a composite index by combining field names Car.index("onNameAndColour"); // remove an index Car.dropIndex("onName); // remove all indexes (except the mandatory mongo index on _id) Car.dropIndexes(); // get the names of all the existing indexes String [] indexNames = Car.getIndexes(); p. Due to the schemaless nature of mongo, it is possible to create an index on a field which does not exist because a document containing that field may be inserted in the future. Ensure you spell your field names correctly. h3. Authentication and Security p. It is possible to run your mongo database in a secure mode, ensuring that a user must authenticate prior to performing operations on secure data. More information on setting up a secure mongo instance can be found on the Mongo website under "Security and Authentication":http://www.mongodb.org/display/DOCS/Security+and+Authentication. p. Assuming you have setup your database correctly, you can leverage the authentication functionality of the mongo module as follows: bc.. # ensure you set the necessary configuration parameters to match authentication details on your database mongo.username=test mongo.password=test123 p. Now you can perform the following operations in your controllers. bc.. //add a user - with read only access MongoDB.addUser("username","password", true); // or write access MongoDB.addUser("username2","password2", false); // authenticate as a user boolean success = MongoDB.authenticate("username","password"); // remove a user MongoDB.removeUser("username"); p. Please note that readOnly restrictions will only apply on mongo versions 1.3.2+ h2. Test Application p. Included in the module distribution is a play-mongo-test directory. This is a play framework application that runs the code shown in the documentation above. The best to run this is to create a new play framework application and to copy the contents of the play-mongo-test directory there. Be sure to update the path to the mongo module as shown above. h2. What's Next? p. The next step for play-mongo will to be update the module to use the new JPA features provided in version 1.1 of the framework.PK O=| lib/jackson-core-asl-1.6.1.jarPK F= META-INF/MANIFEST.MF TMo0rڀYq6\9Ha)zTnڒ'4͇C(r¤HJƤGC mw 1QrW$4`NmGD.ع]T:=ڧN-uJ OCd+эy G3LJeO44%"OsgLG<-i