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

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -