title: Javascript async function returns [object Promise]
body: <p><code>Async</code> function returns <code>[object Promise]</code> but desired behavior is returning real value.
  I can get the value from <code>console.log</code>.</p>
  
  <p>I guess it is a expected behavior of the function but I have no idea to how to fix my code.</p>
  
  <p>This is in vue.js code using electron-vue and NeDB.</p>
  
  <pre><code>&lt;template&gt;
    &lt;div&gt;
      {{ testNedb3('NDId6sekw6VYLmnc')  //this is a test by adding specific id }}
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  import Promise from 'bluebird'
  export default {
    methods: {
      dbFindAsync2: function (db, opt) {
        return new Promise(function (resolve, reject) {
          db.find(opt, function (err, doc) {
            if (err) {
              reject(err)
            } else {
              resolve(doc)
            }
          })
        })
      },
      testNedb3: async function (id) {
        const flattenMemAsync = function (arr) {
          return new Promise(function (resolve) {
            Array.prototype.concat.apply(
              [],
              arr.map(function (arr) {
                resolve(arr.members)
              })
            )
          })
        }
        const filterByNameIdAsnc = function (arr) {
          return new Promise(function (resolve) {
            const result = arr.filter(function (member) {
              return member.nameId === id
            })
            resolve(result)
          })
        }
        this.dbFindAsync2(
          this.$db, { 'members.nameId': id }, { 'members': 1, _id: 0 }
        ).then(function (res) {
          const docs = res
          flattenMemAsync(docs).then(function (res) {
            const flatMembers = res
            filterByNameIdAsnc(flatMembers).then(function (res) {
              console.log('result', res)
              console.log('result_firstname', res[0].firstName)
              return res
            })
          })
        })
      },
  </code></pre>
  
  <p><code>this.$db</code> is getting data from NeDB and the data is two-dimensional array, so I am trying to flat the array by <code>flattenMemAsync</code> and remove unexpected data by <code>filterByNameIdAsnc</code>.</p>
  
  <p><code>console.log('result', res)</code> returns array and <code>console.log('result_firstname', res[0].firstName)</code> returns string.</p>
  
  <p>I have changed calling code from <code>{{ testNedb3('NDId6sekw6VYLmnc') }}</code> to <code>{{ {{ testNedb3('NDId6sekw6VYLmnc').then(value =&gt; {return value}) }}</code> but the result is same.</p>
  
  <p>Also changed to <code>{{ await testNedb3('NDId6sekw6VYLmnc').then(value =&gt; {return value}) }}</code> but I got error "Parsing error: Cannot use keyword 'await' outside an async function.".</p>
  
  <p>Any comment can help me.
  Thank you.</p>