MongoRepository @Query Failed to parse string as a date The 2019 Stack Overflow Developer Survey Results Are InSpring data mongodb search for ISO dateMongoRepository JSON Date Query (Spring)How to query MongoDB with “like”?Query for documents where array size is greater than 1how to dynamically set the hostname with MongoRepositoryMongoRepository query for between datesSpring MongoRepository @Query JSONParseExceptionMongoRepository dynamic queriesMongoRepository JSON Date Query (Spring)Mongoose date comparison does not return correct resultSpring MongoRepository custom queryAggregation queries and MongoRepository

Delete all lines which don't have n characters before delimiter

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Protecting Dualbooting Windows from dangerous code (like rm -rf)

Multiply Two Integer Polynomials

Origin of "cooter" meaning "vagina"

Falsification in Math vs Science

Button changing it's text & action. Good or terrible?

What does ひと匙 mean in this manga and has it been used colloquially?

Is a "Democratic" Oligarchy-Style System Possible?

Earliest use of the term "Galois extension"?

How to obtain Confidence Intervals for a LASSO regression?

Time travel alters history but people keep saying nothing's changed

Why can Shazam fly?

What do hard-Brexiteers want with respect to the Irish border?

Are there incongruent pythagorean triangles with the same perimeter and same area?

What is the meaning of the verb "bear" in this context?

Are there any other methods to apply to solving simultaneous equations?

How to notate time signature switching consistently every measure

Pokemon Turn Based battle (Python)

"as much details as you can remember"

Shouldn't "much" here be used instead of "more"?

How to type this arrow in math mode?

Have you ever entered Singapore using a different passport or name?

Return to UK after being refused entry years previously



MongoRepository @Query Failed to parse string as a date



The 2019 Stack Overflow Developer Survey Results Are InSpring data mongodb search for ISO dateMongoRepository JSON Date Query (Spring)How to query MongoDB with “like”?Query for documents where array size is greater than 1how to dynamically set the hostname with MongoRepositoryMongoRepository query for between datesSpring MongoRepository @Query JSONParseExceptionMongoRepository dynamic queriesMongoRepository JSON Date Query (Spring)Mongoose date comparison does not return correct resultSpring MongoRepository custom queryAggregation queries and MongoRepository



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















First of all, my issue is searching Collecttions in MongoDB via Spring JPA (MongoRepository).



My Object:




"_id" : ObjectId("5c78e1f447f39c2eacb229d7"),
"lab" : "xxx",
"type" : "Holiday",
"description" : "Lunar New Year",
"start_date" : ISODate("2019-02-04T02:37:42.152Z"),
"end_date" : ISODate("2019-02-08T06:37:42.152Z"),
"all_day" : true,
"_class" : "xxx.Event"



i can do as my wish in Mongo query as:



db.getCollection('event').find("start_date" : $gte :ISODate( "2019-02-03T02:37:42.152Z") , $lte :ISODate( "2019-02-08T02:37:42.152Z"))


(you can replace ISODate with new Date)



But to do it in Spring, i want to do it as:



@Query(" $or: [ start_date : $gte :ISODate( ?0 ) , $lte :ISODate( ?1) , end_date : $gte :ISODate( ?0) , $lte :ISODate( ?1) ] } ")
List<Event> findAllEventByTime(String from, String to);


But it fail, i searched in two topic:
here
and there



and end up with



@Query(" 'start_date' : $gte : '$date': '?0', $lte :'$date': '?1' ")
List<Event> findAllEventByTime(String from, String to);


But once again, i had the problem with parsing:




2019-03-22 10:09:48.261 ERROR 9316 --- [ XNIO-2 task-1]
o.z.problem.spring.common.AdviceTrait : Internal Server Error



org.bson.json.JsonParseException: Failed to parse string as a date at
org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)




I try with recomment:



Try param: Fri Mar 22 10:09:48 ICT 2019 and 2019-03-22T03:09:48.227Z and 2016-04-14 00:00:00



All of this going down...
Can you guys help me to fix it?



Work-Flow: Params from FE (String) ~> Go to BE ~> Call Repo as above










share|improve this question




























    0















    First of all, my issue is searching Collecttions in MongoDB via Spring JPA (MongoRepository).



    My Object:




    "_id" : ObjectId("5c78e1f447f39c2eacb229d7"),
    "lab" : "xxx",
    "type" : "Holiday",
    "description" : "Lunar New Year",
    "start_date" : ISODate("2019-02-04T02:37:42.152Z"),
    "end_date" : ISODate("2019-02-08T06:37:42.152Z"),
    "all_day" : true,
    "_class" : "xxx.Event"



    i can do as my wish in Mongo query as:



    db.getCollection('event').find("start_date" : $gte :ISODate( "2019-02-03T02:37:42.152Z") , $lte :ISODate( "2019-02-08T02:37:42.152Z"))


    (you can replace ISODate with new Date)



    But to do it in Spring, i want to do it as:



    @Query(" $or: [ start_date : $gte :ISODate( ?0 ) , $lte :ISODate( ?1) , end_date : $gte :ISODate( ?0) , $lte :ISODate( ?1) ] } ")
    List<Event> findAllEventByTime(String from, String to);


    But it fail, i searched in two topic:
    here
    and there



    and end up with



    @Query(" 'start_date' : $gte : '$date': '?0', $lte :'$date': '?1' ")
    List<Event> findAllEventByTime(String from, String to);


    But once again, i had the problem with parsing:




    2019-03-22 10:09:48.261 ERROR 9316 --- [ XNIO-2 task-1]
    o.z.problem.spring.common.AdviceTrait : Internal Server Error



    org.bson.json.JsonParseException: Failed to parse string as a date at
    org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)




    I try with recomment:



    Try param: Fri Mar 22 10:09:48 ICT 2019 and 2019-03-22T03:09:48.227Z and 2016-04-14 00:00:00



    All of this going down...
    Can you guys help me to fix it?



    Work-Flow: Params from FE (String) ~> Go to BE ~> Call Repo as above










    share|improve this question
























      0












      0








      0








      First of all, my issue is searching Collecttions in MongoDB via Spring JPA (MongoRepository).



      My Object:




      "_id" : ObjectId("5c78e1f447f39c2eacb229d7"),
      "lab" : "xxx",
      "type" : "Holiday",
      "description" : "Lunar New Year",
      "start_date" : ISODate("2019-02-04T02:37:42.152Z"),
      "end_date" : ISODate("2019-02-08T06:37:42.152Z"),
      "all_day" : true,
      "_class" : "xxx.Event"



      i can do as my wish in Mongo query as:



      db.getCollection('event').find("start_date" : $gte :ISODate( "2019-02-03T02:37:42.152Z") , $lte :ISODate( "2019-02-08T02:37:42.152Z"))


      (you can replace ISODate with new Date)



      But to do it in Spring, i want to do it as:



      @Query(" $or: [ start_date : $gte :ISODate( ?0 ) , $lte :ISODate( ?1) , end_date : $gte :ISODate( ?0) , $lte :ISODate( ?1) ] } ")
      List<Event> findAllEventByTime(String from, String to);


      But it fail, i searched in two topic:
      here
      and there



      and end up with



      @Query(" 'start_date' : $gte : '$date': '?0', $lte :'$date': '?1' ")
      List<Event> findAllEventByTime(String from, String to);


      But once again, i had the problem with parsing:




      2019-03-22 10:09:48.261 ERROR 9316 --- [ XNIO-2 task-1]
      o.z.problem.spring.common.AdviceTrait : Internal Server Error



      org.bson.json.JsonParseException: Failed to parse string as a date at
      org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)




      I try with recomment:



      Try param: Fri Mar 22 10:09:48 ICT 2019 and 2019-03-22T03:09:48.227Z and 2016-04-14 00:00:00



      All of this going down...
      Can you guys help me to fix it?



      Work-Flow: Params from FE (String) ~> Go to BE ~> Call Repo as above










      share|improve this question














      First of all, my issue is searching Collecttions in MongoDB via Spring JPA (MongoRepository).



      My Object:




      "_id" : ObjectId("5c78e1f447f39c2eacb229d7"),
      "lab" : "xxx",
      "type" : "Holiday",
      "description" : "Lunar New Year",
      "start_date" : ISODate("2019-02-04T02:37:42.152Z"),
      "end_date" : ISODate("2019-02-08T06:37:42.152Z"),
      "all_day" : true,
      "_class" : "xxx.Event"



      i can do as my wish in Mongo query as:



      db.getCollection('event').find("start_date" : $gte :ISODate( "2019-02-03T02:37:42.152Z") , $lte :ISODate( "2019-02-08T02:37:42.152Z"))


      (you can replace ISODate with new Date)



      But to do it in Spring, i want to do it as:



      @Query(" $or: [ start_date : $gte :ISODate( ?0 ) , $lte :ISODate( ?1) , end_date : $gte :ISODate( ?0) , $lte :ISODate( ?1) ] } ")
      List<Event> findAllEventByTime(String from, String to);


      But it fail, i searched in two topic:
      here
      and there



      and end up with



      @Query(" 'start_date' : $gte : '$date': '?0', $lte :'$date': '?1' ")
      List<Event> findAllEventByTime(String from, String to);


      But once again, i had the problem with parsing:




      2019-03-22 10:09:48.261 ERROR 9316 --- [ XNIO-2 task-1]
      o.z.problem.spring.common.AdviceTrait : Internal Server Error



      org.bson.json.JsonParseException: Failed to parse string as a date at
      org.bson.json.JsonReader.visitDateTimeExtendedJson(JsonReader.java:1057)




      I try with recomment:



      Try param: Fri Mar 22 10:09:48 ICT 2019 and 2019-03-22T03:09:48.227Z and 2016-04-14 00:00:00



      All of this going down...
      Can you guys help me to fix it?



      Work-Flow: Params from FE (String) ~> Go to BE ~> Call Repo as above







      mongodb spring-data-jpa spring-data-mongodb mongorepository






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 3:31









      Nam NguyễnNam Nguyễn

      293212




      293212






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can make spring data jpa method for the same like below:-



          List<Event> findByStart_dateIsAfterAndEnd_dateIsBefore(Date startDate, Date endDate);





          share|improve this answer























          • I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

            – Nam Nguyễn
            Mar 22 at 7:32











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292497%2fmongorepository-query-failed-to-parse-string-as-a-date%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You can make spring data jpa method for the same like below:-



          List<Event> findByStart_dateIsAfterAndEnd_dateIsBefore(Date startDate, Date endDate);





          share|improve this answer























          • I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

            – Nam Nguyễn
            Mar 22 at 7:32















          0














          You can make spring data jpa method for the same like below:-



          List<Event> findByStart_dateIsAfterAndEnd_dateIsBefore(Date startDate, Date endDate);





          share|improve this answer























          • I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

            – Nam Nguyễn
            Mar 22 at 7:32













          0












          0








          0







          You can make spring data jpa method for the same like below:-



          List<Event> findByStart_dateIsAfterAndEnd_dateIsBefore(Date startDate, Date endDate);





          share|improve this answer













          You can make spring data jpa method for the same like below:-



          List<Event> findByStart_dateIsAfterAndEnd_dateIsBefore(Date startDate, Date endDate);






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 22 at 7:07









          Nishant BhardwazNishant Bhardwaz

          1,065514




          1,065514












          • I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

            – Nam Nguyễn
            Mar 22 at 7:32

















          • I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

            – Nam Nguyễn
            Mar 22 at 7:32
















          I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

          – Nam Nguyễn
          Mar 22 at 7:32





          I do try: List<Event> findAllBystartDate(Instant startdate); and get : 2019-03-22 11:22:15.059 ERROR 7740 --- [ XNIO-2 task-3] o.z.problem.spring.common.AdviceTrait : Internal Server Error org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.time.ZonedDateTime.

          – Nam Nguyễn
          Mar 22 at 7:32



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292497%2fmongorepository-query-failed-to-parse-string-as-a-date%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

          밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

          1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴