2

I am working on application development using play framework having mongodb as backend, i have installed mongodb & playframework successfully on my ubuntu as well as on windows, but if i want to work with mongodb i need morphia module of play framework, i have downloaded morphia module and tries to install, but it gives me an error like this ,

root@ubuntu:~/apps/tmp1# play install morphia
[info] Loading project definition from /root/apps/tmp1/project
[info] Set current project to tmp1 (in build file:/root/apps/tmp1/)
[error] Not a valid command: install (similar: initialize, inspect, shell)
[error] Not a valid project ID: install
[error] Not a valid configuration: install (similar: optional)
[error] Not a valid key: install (similar: initialize, dist, stage)
[error] install
[error]        ^
root@ubuntu:~/apps/tmp1# 

i have even tried to change the dependencies.yml file but, still i am unable to work with it...

Srujal Kachhela
  • 209
  • 1
  • 4
  • 15

3 Answers3

3

It looks like you are using play 2. Look at the documentation of morphia, it clearly states:

This module is for the Play 1.x series only.

Instead of using morphia, you can use the java driver directly.

EDIT: There is a morphia plugin for play 2 available here

Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
aaberg
  • 2,253
  • 15
  • 14
  • No problem :) I just realized, that it actually might be possible to use morphia for play2. Instead of using the play morphia module, you might be able to use morphia directly (Morphia is not only a play module). I haven't tried it, but it might be worth a try. Look at http://code.google.com/p/morphia/ – aaberg Jun 06 '12 at 10:29
  • Yeah. It wouldn't be all too hard to build a module for morphia for 2.0. You basically just need to have a singleton class where you keep your morphia objects. There are two competing modules out for mongo + play 2 already: https://github.com/vznet/mongo-jackson-mapper (more aimed toward Java) and https://github.com/leon/play-salat (more aimed toward Scala) – Eve Freeman Jun 06 '12 at 21:01
  • Thank you Wes Freeman, i have got one demo at [link](https://github.com/czihong/playMongoDemo) and as per the tutorial it worked perfectly for me.... – Srujal Kachhela Jun 07 '12 at 09:48
1

I started using Marphia with play framework 2.x. I followed this example to install marphia plugin: https://github.com/czihong/playMongoDemo

Karthik Sankar
  • 817
  • 8
  • 11
0

Just as a note, I forked the playMongoDemo and updated it to work with Play 2.1.4. I sent a pull request, but in the meantime, it's available here: https://github.com/subdigit/playMongoDemo

Once/If the pull request is accepted, I'll probably delete the local fork so you can use the master: https://github.com/czihong/playMongoDemo

subdigit
  • 431
  • 4
  • 9