mongodb - How to query by date using mongo repository in spring boot? -


i have developed application in spring boot mongo reposotory. using spring data jpa. , declared in many tables createddate date util package in java , date stores in db iso formatted. when query using mongo repository findbycreateddate(date date) gives no result.

below model class

@document public class barmodel extends baseentity {      @notnull     @size(min = 2, max = 140)     string name;     string address;     string city;     string state;     string zipcode;     string phone;     string description;     string primimage;     @dbref     location location;     @dbref     list<special> specials;  }  @mappedsuperclass @entitylisteners(auditingentitylistener.class) public abstract class baseentity {      @id     private string id;      @createdby     private string createdby = getcurrentauditor();      @createddate     @datetimeformat(iso = iso.date_time)     private date creationtime = new date();      @createdby     @lastmodifiedby     private string modifiedby = getcurrentauditor();      @createddate     @lastmodifieddate     @datetimeformat(iso = iso.date_time)     private date modificationtime = new date(); }  @transactional public interface barmodelrepository extends mongorepository<barmodel, string> {      page<barmodel> findbycreationtime(pageable pageable, date creationtime);      public list<barmodel> findbycreationtime(date from, date to); } 


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -