mongodb - JacksonDBCollection findOne query and not working java -
i trying implement findone query on json:
my json looks this:
{ "_id":{ "$oid":"5613b8d360b292805a5d7f2d" }, "resellerid":"1" .... } and here java code:
final jacksondbcollection<mongodocument, string> resellerwidget = jacksondbcollection.wrap(mongodb.getcollection("resellerwidget"), mongodocument.class, string.class); mongodocument md = resellerwidget.findone(dbquery.and(dbquery.is("_id",widgetid), (dbquery.is("resellerid", resellerid)))); but not find record. when query widgetid though, find it.
relevant part of mongodocument:
@jsonignoreproperties(ignoreunknown = true) public class mongodocument { private string id; private string resellerid; private final map<string, jsonnode> extraproperties = new hashmap<>(); @objectid @jsonproperty("_id") public string getid() { return this.id; } @objectid @jsonproperty("_id") public void setid(string id) { this.id = id; } @jsonproperty("resellerid") public string getresellerid() { return this.resellerid; } @jsonproperty("resellerid") public void setresellerid(string id) { this.resellerid = id; } anyone idea i'm missing?
code works, frontend contained bug submitting wrong field name.
Comments
Post a Comment