MongoDB vs Firebase

The code would have to look like this:

function test(data) {
if (data) {
return true
} else {
return false
  }
 }