MongoDB java driver : filter by the id -
i use latest version of java driver of mongodb. unfortunately after searching not able filter _id ...
i tried lot of things :
_id id_objet = new _id(); id_objet.set$oid(idobjet); document mydoc = collection.find(eq("_id", id_objet)).first();
i got bad request error grizzly ...
what proper way filter _id latest version of driver ?
thanks help
it not big deal :
document mydoc = collection.find(eq("_id", new objectid(idobjet))).first();
you have use objectid(id).
Comments
Post a Comment