Hi I was implementing the scheduler to read data from mongo db using
FindIterable<Document> findIter = collection.find(new Document(datefilterField, new Document("$gt", date))).sort(sortQuery); and please find below error stack
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'bad sort specification' on server localhost:27017]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'bad sort specification' on server localhost:27017
at com.mongodb.operation.FindOperation$1.call(FindOperation.java:493)
at com.mongodb.operation.FindOperation$1.call(FindOperation.java:483)
at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:241)
at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:214)
at com.mongodb.operation.FindOperation.execute(FindOperation.java:483)
at com.mongodb.operation.FindOperation.execute(FindOperation.java:80)
at com.mongodb.Mongo.execute(Mongo.java:818)
at com.mongodb.Mongo$2.execute(Mongo.java:805)
at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
at com.mongodb.OperationIterable.forEach(OperationIterable.java:70)
at com.mongodb.FindIterableImpl.forEach(FindIterableImpl.java:158)
at com.nazara.ngdp.TableauServiceHelper.MongoDataAccessor.readCollection(MongoDataAccessor.java:70)
at com.nazara.ngdp.TableauServiceHelper.ScheduleTableauJob.execute(ScheduleTableauJob.java:68)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
... 1 more