Subfield ordering problem in 2.0.0 RC1

51 views
Skip to first unread message

Ján Raška

unread,
Feb 25, 2013, 3:53:32 AM2/25/13
to rogue...@googlegroups.com
Hi folks,

I've been trying to migrate from 1.1.7 to 2.0.0 RC1 and I've faced an issue that took me some time to figure out due to lack of documentation. I have a BsonRecordField that contains a DateField (createdAt). Now if I try to sort on that subfield I got a compilation error:

Meta where (_condition_) orderDesc (_.message.subfield(_.createdAt))

resulted in:

type mismatch;

[error]  found   : com.foursquare.rogue.SelectableDummyField[java.util.Date,x.Meta]

[error]  required: com.foursquare.rogue.AbstractQueryField[_, _, _, x.Meta]

[error] Note that implicit conversions are not applicable because they are ambiguous:

[error]  both method rdateFieldToQueryField in trait Rogue of type [M](f: com.foursquare.field.Field[java.util.Date,M])com.foursquare.rogue.QueryField[java.util.Date,M]

[error]  and method rdateFieldToDateQueryField in trait Rogue of type [M](f: com.foursquare.field.Field[java.util.Date,M])com.foursquare.rogue.DateQueryField[M]

[error]  are possible conversion functions from com.foursquare.rogue.SelectableDummyField[java.util.Date,x.Meta] to com.foursquare.rogue.AbstractQueryField[_, _, _, x.Meta]


It seems that lines 54 and 55 in Rogue.scala cause that since both QueryField and DateQueryField extend AbstractQueryField, thus implicit conversion fails to apply:

implicit def rdateFieldToQueryField[M](f: RField[Date, M]): QueryField[Date, M] = new QueryField(f)
implicit def rdateFieldToDateQueryField[M](f: RField[Date, M]): DateQueryField[M] = new DateQueryField(f)

Jason Liszka

unread,
Feb 25, 2013, 3:13:17 PM2/25/13
to rogue...@googlegroups.com
Hi Jan,

Sorry about that. I think those implicits exist to support both Date and DateTime in query expressions. But as you found, it appears to cause problems with ordering (and probably also select). Does everything work ok if you remove line 54?

Would anyone object if I removed support for Date, leaving only DateTime? I can push a fix later today.


--
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/groups/opt_out.
 
 

Alexandre Richonnier

unread,
Mar 17, 2013, 1:45:38 PM3/17/13
to rogue...@googlegroups.com
to temporary fix your code you can do something like :
orderDesc(m => rdateFieldToDateQueryField( m.message.subfield(_.createdAt)))

Tim Nelson

unread,
Jun 14, 2013, 12:06:07 PM6/14/13
to rogue...@googlegroups.com
Hi,

Did this ever get resolved?

I'd vote for removing Date support if that fixes the problem.

Tim

Jason Liszka

unread,
Jun 18, 2013, 11:58:14 AM6/18/13
to rogue...@googlegroups.com
I'm looking into this today.

Jason Liszka

unread,
Jun 28, 2013, 2:14:53 PM6/28/13
to rogue...@googlegroups.com
This should be resolved with the 2.1.0 release.
Reply all
Reply to author
Forward
0 new messages