Gontran Magnat
unread,Jan 7, 2011, 11:42:13 AM1/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hello all,
I'm having a problem while using mongoDb with Java.
I'm inserting documents in a collection using an md5 key as id.
When I look for these objects using their id in the mongo client, I
find them.
But when I look for them from my java application, I cannot find any.
Here is the peace of code:
String ick_to_use = md5(ick); //ick is just a normal String object.
DBObject icDoc = _ichm.findOne(new BasicDBObject("_id", ick_to_use));
if (icDoc == null) {
icDoc = new BasicDBObject("_id", ick_to_use);
}
else{
System.out.println("index already exists");
}
_ichm.save(icDoc);
When I call this piece of code without the md5 encoding, I find some
not null icDoc.
But as soon as I add the md5 encoding, no way to find them.
Do you have an idea?
Thanks in advance.