title: Node.js cannot read property 'then' of undefined
body: <p>I try to use a global function where i can use for some mysql functions, but the problem is that js say that the ".then" is undefined, what make i wrong, is this only an syntax error?</p>
  
  <pre><code> static connectWidthCortex(){
    xdevapi.getSession({
          host: 'localhost',
          port: 33060,
          dbUser: 'admin',
          dbPassword: 'xxxx'
      }).then((session)=&gt; {
    return session.getSchema("cortex");
  });
  };
  
  static createCollection(collname){
      this.connectWidthCortex().then((db)=&gt; {
    console.log("Cortex connected")
    return db.createCollection(collname);
  }).catch((err)=&gt; {
    console.log("connection failed")
  });
  }
  </code></pre>
  
  <p>Thx for help :)</p>