mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:26:51 +00:00
| .. | ||
| .idea | ||
| src | ||
| target | ||
| .DS_Store | ||
| lift_proto.db.h2.db | ||
| lift_proto.db.lock.db | ||
| lift_proto.db.trace.db | ||
| MavLift.iml | ||
| obp_api.iml | ||
| pom.xml | ||
| README | ||
This project contains some try outs so far.
The project is using Maven 2 as a build tool. See pom.xml for the dependancies.
I used IntelliJ IDEA as my IDE. It has nice autocompletion.
To run, cd into the root directory (where this file is) and run:
mvn jetty:run
To test one of the URL's use:
curl http://localhost:8080/mongodb
Other important files:
Boot.scala
SomeThing.scala - This file contains the URL routes (like urls.py) and my try outs- See serve case Req
I tried several approaches for scala talking to mongodb
Lift Record: works for inserts and simple (inc geo) queries. but i couldn't figure out how to sort.
Rogue: I got this to import but couldn't get the "where" syntax to compile.
Casbah: works including sorting. :-)
Casbah is the officialy supported Scala driver for MongoDB. It is a thin wrapper for the Java driver which is very well used
so I guess its a good choice at least until we understand how to use Lift Record/ Rogue better.
We can still use Lift Record for inserts etc.
It also has a full time developer working on it. The documentation tends to lack examples, but this helps:
https://github.com/mongodb/casbah/blob/master/casbah-query/src/test/scala/DSLCoreOperatorsSpec.scala#L861-984
You'll also need to add the import statement to get the query syntax:
import com.mongodb.casbah.query.Imports._
To start mongodb
sudo mongod
Note: you might want to look at the mongo data from the mongo command line:
db.chooseitems.find( { location : { $near : [2,2] } } )
etc.
s.r.