Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Last active July 18, 2018 19:23
Show Gist options
  • Select an option

  • Save gabidavila/d6b98b227166f093cb88d5b54555f499 to your computer and use it in GitHub Desktop.

Select an option

Save gabidavila/d6b98b227166f093cb88d5b54555f499 to your computer and use it in GitHub Desktop.
const mysqlx = require('@mysql/xdevapi');
const options = require('./config')
mysqlx.getSession(options)
.then((session) => {
const db = session.getSchema("worldcup");
const tableTeams = db.getTable("teams");
return tableTeams;
})
.then((t) => {
t.select(['id', 'name', 'players'])
.where('name = :name')
.bind('name', 'Brazil')
.limit(1)
.execute(console.log);
})
.catch(err => {
console.log(err.stack);
process.exit(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment