[JAVA-624] Date range with mongoTemplate gte and lte function is not working on cloudfoundry. Created: 16/Aug/12 Updated: 11/Sep/19 Resolved: 01/Sep/12 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Jitender Saini | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hi! I've inserted data to cloudfoundry(cf) mongodb with the following script.
Now I'm trying fetching the code with the following java code.
while I try this on my local mongodb and tomcat server it says. Begin---> Wed Aug 01 00:00:00 IST 2012 }} , { "expenseDate" : { "$lte" : { "$date" : "2012-08-30T18:30:00.000Z"}}}] , "userid" : "5d88cd6f-6f6f-4957-abc2-24f5e2c853ee"} fields: null for class: class com.expense.domains.Expense in collection: expense But while I try to run the same code on cloudfoundry it prints Begin---> Wed Aug 01 00:00:00 UTC 2012 }} , { "expenseDate" : { "$lte" : { "$date" : "2012-08-31T00:00:00.000Z"}}}] , "userid" : "5d88cd6f-6f6f-4957-abc2-24f5e2c853ee"} fields: null for class: class com.expense.domains.Expense in collection: expense There might be a timezone problem... I don't know. I've crossed verified that cloudfoundry mongodb and my local mongodb contains the exactly same data. While I say findAll() for expense on cloudfoundry it returns 6 records, But while I give the same for daterange with gte and lte function the same is not returning any record on cloudfoundry. Please suggest me solution ASAP since I'm stuck because of this issue. Thanks Jitender Saini |
| Comments |
| Comment by Jeffrey Yemin [ 01/Sep/12 ] | |
|
OK, glad you got it working. | |
| Comment by Jitender Saini [ 01/Sep/12 ] | |
|
Hi!, I managed to fixed the issue, Actually It was a problem with mongo service provided by cloudfoundry. Recreating the service on cloudfoundry makes it run flawlessly. Thanks Jitender | |
| Comment by Jeffrey Yemin [ 01/Sep/12 ] | |
|
Have you been able to re-execute your tests? I'd like to close this issue out. | |
| Comment by Jeffrey Yemin [ 17/Aug/12 ] | |
|
I'm not sure what the problem is. Can you execute your tests and attach server logs (with at least -v log level) for both local and cloudfoundry mongod instances? | |
| Comment by Jitender Saini [ 17/Aug/12 ] | |
|
Hi! Jeff Yemin, Thanks for your comment. I just want to highlight here that Please ignore the userid, as userid is very much there in insert script and database. Just because I want to squeeze the code snippet here that's why I didn't mentioned the userid here. The entry is already present in the script e.g. expense162.setUserid("IDValue"); and the same gets insert into database. Just for your second suggestion that the changes in Criteria replacing the calendar1.getTime(), let me implement and check the same but it doesn't seems it may work. I just want to notify that the same code is working very much on my local workstation with tomcat server, but it showing problem with Cloudfoundry mongodbservice for the date range queries only. Rest of the queries are working very fine on cloudfoundry also e.g. findAll() they are returning proper rows of data. Only date range queries are breaking whereas the same date range queries with the same data are working very much fine on local workstation. Please check and let me know if you want some more details about code from me. Thanks Jitender Saini | |
| Comment by Jeffrey Yemin [ 17/Aug/12 ] | |
|
I could see how time zone issues might cause the first and the fifth expense to be filtered out, but not the others. Your code sample doesn't include anything that sets the userid. Is it possible that the date is not the issue, but rather the userId? As an aside, and I don't think this will solve your problem, but your query can be more succinctly and efficiently expressed as:
|