the If Else statement is fine. It is written well and placed in the right spot. The issue; I think, is with your query. You are currently looking through the entire downloads database and returning all objects whos status is undefined. Not filtering by a specific item. This should return an object as results.items. Calling .length on an object returns undefined which could cause it throw an error and not evaluate the if else statement. I would start by calling console.log() on the returned data to ensure it is not misshaped.