Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8604771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:39:31+00:00 2026-06-12T02:39:31+00:00

event class definition class event extends MongoRecord[event] with MongoId[event]{ def meta = event object

  • 0

event class definition

  class event extends MongoRecord[event] with MongoId[event]{
      def meta = event
      object title extends StringField(this, 70)
      object description extends StringField(this, 200)
      object date_time extends DateTimeField(this)
      object email extends StringField(this, 70)
      object placeName extends StringField(this, 70)
      object placeLat extends DoubleField(this) 
      object placeLon extends DoubleField(this) 
      object placeCity extends StringField(this, 100)


      }
object event extends event with MongoMetaRecord[event] 

Storing date from text:

val event_temp = event.createRecord
val cal = Calendar.getInstance()
val dashDate = new SimpleDateFormat("yyyy/MM/dd HH:mm")
cal.setTime(dashDate.parse(String))
event_temp.date_time(cal)
event_temp.save

Getting the events and sorting

val events= event.findAll
events.sortWith(_.date_time.is before _.date_time.is)

events is List[event], while date_time.is returns java.util.Calendar.
It returns the unsorted List[event].

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:39:33+00:00Added an answer on June 12, 2026 at 2:39 am

    I see no problem with Scala 2.9.1:

    scala> def d(y:Int) = { val c = Calendar.getInstance; c.setTime(new Date(y,0,0)); c }
    warning: there were 1 deprecation warnings; re-run with -deprecation for details
    d: (y: Int)java.util.Calendar
    
    scala> val cs = d(100) :: d(1) :: d(1000) :: d(150) :: Nil 
    // List[java.util.Calendar] .. removed long and useless
    
    scala> val cs2 = cs sortWith { _ before _ } 
    // List[java.util.Calendar] .. removed long and useless
    
    scala> cs map { _.getTimeInMillis }
    res21: List[Long] = List(946605600000, -2177528012000, 29347927200000, 2524528800000)
    
    scala> cs2 map { _.getTimeInMillis }
    res22: List[Long] = List(-2177528012000, 946605600000, 2524528800000, 29347927200000)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My class with an event: public class WindowModel { public delegate void WindowChangedHandler(object source,
im trying to do this: class Event < ActiveRecord::Base belongs_to :previous_event has_one :event, :as
I have this code : class Event{}; class CustomEvent:public Event{}; class Handler { public:
Say I make a class that extends the movieclip class and this class has
In plain Ruby, this works just fine: class TestSuper def foo puts In TestSuper.foo
Here is my class definition for a customized event args using System; public class
I have following event class. I have a question related to the Property method
I have defined an Event class: Event and all the following classes inherit from
I have an Event class. Due to the way dates are handled, we need
I need to avoid serializing an Event class member because when the event is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.