-
Dec 11th, 2011, 06:26 PM
#1
Issue with Spring Mongodb RC1.0
I used 1.0M4 (with core 1.2.0M1), mongo driver 2.6.5, without problems. But after upgrade to 1.0RC1 (and core 1.2.0RC1), mongo driver 2.7.2, I have a problem:
query {"name":"root", "isDeleted" : false} return null.
I then revert back to Spring mongo 1.0M4 + core 1.2.0 M1 + driver 2.7.2, same query is ok.
So it is not caused by the mongodb driver then.
any idea why?
name is the string, isDeleted is Boolean.
-
Dec 11th, 2011, 08:19 PM
#2
My code is something like this:
Query query = new Query(Criteria.where(Constants.MODEL_ID).is(id));
query.addCriteria (Criteria.where("isDeleted").is(false));
HashMap user = mongoTemplate.findOne (query, HashMap.class, "users");
it returns null although there is a document matching the criteria (it returns the correct document if I use M4)
-
Dec 12th, 2011, 05:53 AM
#3
Would you mind coming up with a more detailed context? What's the data inside your collection, what does the actually generated query look like? What if you try executing the generated query in the mongo shell?
-
Dec 12th, 2011, 06:24 PM
#4
* mongo shell is ok.
* logger.debug("queryByAttribute : " + query.getQueryObject().toString()) output : {"name":"root", "isDeleted" : false}
* User Data :
{
"_id" : "c9d36006-5972-468a-a2bb-403b29faf3f9",
"name" : "root",
"displayName" : "root",
"password" : new BinData(0, "Y6nw6nu5gFB5a2SehUgYRQ=="),
"roles" : ["db2962f4-2993-4e82-b77a-635ae845ecaa"],
"organizationId" : "1feaf1f0-85d9-44c8-8ce6-89de43f31be9",
"departmentId" : "1feaf1f0-85d9-44c8-8ce6-89de43f31be9",
"isDeleted" : false,
"createdTime" : new Date("Mon, 12 Dec 2011 13:41:08 GMT +08:00"),
"lastModifiedTime" : new Date("Mon, 12 Dec 2011 13:41:08 GMT +08:00")
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules