Maarten Koopmans <
maarten....@gmail.com> writes:
> Hi,
>
> I've never used record (and with Mongo at that) before - either Mapper
> or my own K/V serializations. Anyway, I'm missing something which I
> suspect is obvious "once you know it".
>
> I have an extremely simple model class to emulate sessions:
>
> class SessionData extends MongoRecord[SessionData] with MongoId[SessionData] {
>
> def meta = SessionData
>
> object sessionkey extends StringField(this,"")
> object since extends LongField(this,0L)
>
> }
>
> Bu for some reason this query wrapped in a function with guid:String
> as parameter...
>
> for(v <- SessionData.find("sesssionkey",guid) ) yield
> v.sessionkey.valueBox.openOr("Not")
>
> insists on having a Box[String] as return type at compile time. I have
> the feeling I'm snow-blind (long time, and obviously with learning a
> new setup...)
SessionData.find("sesssionkey",guid).map(v => v.sessionKey.valueBox.openOr("Not"))
so the "yield" result is always wrapped in a Box. You probably want the