java - Check if Object (document) exists in MongoDB (using Jongo) -
i'm trying find out if object (document) exists in collection.
here's i've tried i'm stuck.
@dbtable(name = "websites") private mongocollection websitestable; private boolean isintable(string url) { findone p = websitestable.findone("{url: #}", url); return false; }
how check, if given url
in collection? appreciated.
try this:
return websitestable.findone("{url: #}", url) .as(map.class) .iterator() .hasnext();
Comments
Post a Comment