Async/await nodejs.9 unusual Syntax Error : unexepected token function


#1

hello
i want to use async/await in my app, basically for querying my db

i have this function :

async function getVariables() {

var id = await Service.getIdByName('JollyClick')

console.log(id)

}
which is supposed to call this :

serviceSchema.statics.getIdByName = async function getIdByName (serviceName) {

this.findOne({name :serviceName }).exec().then(function(service){
    return service._id
})

}
but i get an error :

async function getVariables() {
^^^^^^^^

SyntaxError: Unexpected token function
i am using node v9

its seems to be a problem with the IDE