我试图将json与MongoDb中具有相同值的文档进行比较。但无论两者是否相同,它都会返回false。
所以伙计们,让我帮忙
我已经提供了有关我的代码的详细信息以获得帮助。
**//comparison code**
DBObject dbObject = (DBObject)JSON.parse(json4);
boolean val=collection.equals(dbObject);
System.out.println(val);
System.out.println(dbObject);
**//document stored into 'dummyColl' collection**
> db.dummyColl.find().pretty();
{
"_id" : "11",
"xml" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><tr
ansperfect><DEV id=\"11\"><lastname>yong11</lastname><nickname>mook kim11</nickn
ame><salary>mkyong11</salary><permanentAddress>10000011</permanentAddress><curre
ntAddress>Bhopal11</currentAddress><contactNo>pune11</contactNo><email>999999999
11</email><alternateMail>test11@basex.com</alternateMail><FacebookName>testA11@b
asex.com</FacebookName><Color>Tom11</Color></DEV></transperfect>"
**//json to compare with document stored into 'dummyColl' collection**
{ "_id" : "11" , "xml" : "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><transperfect><DEV id=\"11\"><lastname>yong11</lastname><nickname>mook kim11</nickname><salary>mkyong11</salary><permanentAddress>10000011</permanentAddress><currentAddress>Bhopal11</currentAddress><contactNo>pune11</contactNo><email>99999999911</email><alternateMail>test11@basex.com</alternateMail><FacebookName>testA11@basex.com</FacebookName><Color>Tom11</Color></DEV></transperfect>"}