title: Check if CosmosDB item exists without try/catch
body: <p>I am using the <a href="https://github.com/Azure/azure-cosmos-js" rel="nofollow noreferrer">Node.js CosmosDB library</a> and I want to check if an item exists.</p>
  
  <p>I have seen some examples which recommend the following:</p>
  
  <pre><code>const i = container.item(id);
  
  try {
      const { item } = await i.read();
      // item exists
  } catch(e) {
      // item does not exist
  }
  </code></pre>
  
  <p>But I don't want to use exceptions for flow control. I also want to avoid using <code>container.items.query</code> - I want to use <code>container.item</code> if possible.</p>
  
  <p>Can I do this?</p>
  
  <hr>
  
  <p>The reason I would like to know how to do this, is I need to call <code>Item.replace</code> to update an item, so I would like to do this:</p>
  
  <pre><code>const i = container.item(id);
  
  if (i.exists() === false) {
      return;
  }
  
  i.replace(replacement);
  </code></pre>
  
  <p>However, if I have to use <code>container.items.query</code>, I will have to do this:</p>
  
  <pre><code>const result = container.items.query(myQuery);
  
  if (result.current() === undefined) {
      return;
  }
  
  container.item(id).replace(replacement);
  </code></pre>