Better way to check if object exists in db?

I find myself writing a ton of this code (or some variation thereof):

var object_in_db = Collection.findOne({key: value});

if (object_in_db) {
  // do something with object....
}

Is there a more concise way to write this that I’m not aware of?

If what you mean by “do something with object” is modifying if there is findAndModify with a popular meteor implementation

But what you want to do is access some of its properties, you will have to first check that it actually exists.

I submitted a pull request last year to add a proper and fast way to check if a document exists.
Here it is:

wow, and these kinds of pull requests are just sitting there collecting dust? :slight_smile: Weird…