Search code examples
mongodbconsoleliftprintln

Println MongoDB Record to Console from lift


I insert a Record into a MongoDB

var test = Entry.createRecord
.name("Williams")
.nr("1")
.save

How can I println these document via query to commandline console?


Solution

  • It depends if you're mongo-java-driver apis, or use the lift-json DSL to construct your queries.

    For JSON, something like.

    Entry.findAll(("name" -> "Williams"))
    

    For API

    val qry = QueryBuilder.start("name").is("Williams").get
    Entry.findAll(qry)