could not find implicit value for evidence parameter of type com.foursquare.rogue.BSONType[org.joda.time.DateTime]

195 views
Skip to first unread message

David Boon

unread,
Mar 12, 2014, 5:09:14 PM3/12/14
to rogue...@googlegroups.com
I could use some help figuring out why I'm getting this error: 

could not find implicit value for evidence parameter of type com.foursquare.rogue.BSONType[org.joda.time.DateTime]


I have a MongoRecord that looks like this(roughly, edited to remove lots of non-relevant fields):

class Invitation extends MongoRecord[Invitation] with ObjectIdKey[Invitation] with IndexedRecord[Invitation] {

  def meta: MongoMetaRecord[Invitation] = Invitation
  object notification    extends BsonRecordListField(this, NotificationBson)
  object users           extends BsonRecordListField(this, UserBson)
  object createdOn       extends JodaTimeWithFixesField(this)
  object changedOn       extends JodaTimeWithFixesField(this)
}

class UserBson extends BsonRecord[UserBson] {
  def meta: BsonMetaRecord[UserBson] = UserBson
  object _id                  extends ObjectIdField(this)
  object reminderLimitReached extends BooleanField(this)
  object nextReminderOn       extends JodaTimeWithFixesField(this)
}


My query on these objects looks like this:

   implicit val jodaDateTimeIsFlattened = new com.foursquare.rogue.Rogue.Flattened[org.joda.time.DateTime, org.joda.time.DateTime]

    val now = DateTime.now

    val invitations = Invitation.where(
      _.notification.subfield(_.notifyStatus) eqs "notified").and(
      _.notification.subfield(_.reminderLimit) gt 0).and(
      _.users.subfield(_.completed) eqs false).and(
      _.users.subfield(_.reminderLimitReached) eqs false).and(
      _.users.subfield(_.nextReminderOn) lt now).and(
      _.createOn lt now.minusDays(2).withTimeAtStartOfDay ).fetch.headOption


And I get this error:


InvitationReminderCommand.scala:36: could not find implicit value for evidence parameter of type com.foursquare.rogue.BSONType[org.joda.time.DateTime]
[error]       _.users.subfield(_.nextReminderOn) lt now).and(


Which I'm certain is related to something I've done wrong when trying to make a specialized JodaTimeField, where I've overridden some json related methods:

class JodaTimeWithFixesField[OwnerType <: Record[OwnerType]](rec: OwnerType) extends JodaTimeField(rec)  {
  def dateFormat =  JodaHelpers.dateTimeFormatter

  override def asJValue: JValue = valueBox.map(v => JString(dateFormat.print(v))) openOr (JNothing: JValue)
  override def asJs = valueBox.map(v => Str(dateFormat.print(v))) openOr JsNull
}


I have the same error when I use _.orderDesc on a field that is defined as JodaTimeWithFixesField.  I need the asJValue and asJs methods because we use asJSON in lots of cases and this seems to help a lot with date formats.  https://groups.google.com/d/msg/rogue-users/6MhUJOIjai8/DQCppGkEdfQJ

Thanks in advance for any help

-David


Jason Liszka

unread,
Mar 12, 2014, 11:34:52 PM3/12/14
to rogue...@googlegroups.com
What version of rogue are you on? 2.3.0 adds an implicit value of type BSONType[DateTime].


--
You received this message because you are subscribed to the Google Groups "rogue-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rogue-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Boon

unread,
Mar 13, 2014, 6:26:31 AM3/13/14
to rogue...@googlegroups.com
Excellent!  Thank you.  



I updated to 2.3.0 and both the orderDesc and the subfield are working as expected.  

I feel a little weird about the dependencies that I had to mash up to get it to work:

  "com.foursquare" %% "rogue-field" % "2.2.1" intransitive(),
  "com.foursquare" %% "rogue-core" % "2.3.0" intransitive(),
  "com.foursquare" %% "rogue-lift" % "2.3.0" intransitive(),
  "com.foursquare" %% "rogue-index" % "2.3.0" intransitive(),

Is rogue-field replaced by something in 2.3.0?

Thanks

Tim Nelson

unread,
Mar 13, 2014, 8:32:13 AM3/13/14
to rogue...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages