Opps!I admit my JavaScript skills are rusty and dusty. Plus I am new to Node.JS. So yesterdays blog drew some very helpful comments from two of MySQL's best. Johannes Schlüter and Rui Quelhas let me know there was a better way to code the example. Much thanks to them. Better Example
// Simple example to grap one record and print it[Read more]
const mysqlx = require('@mysql/xdevapi');
const options = {
host: 'localhost',
port: 33060, // should be a number
dbUser: 'root',
dbPassword: 'Hell0Dave!'
};
mysqlx
.getSession(options)
.then (session => {
var schema = session.getSchema('world_x');
//equivilent of SELECT doc FROM countryinfo where _id = 'USA'
var coll = schema.getCollection('countryinfo');
var query = "$._id == 'USA'";
// Print doc
return Promise.all([
coll.find(query).execute(function (doc) {
console.log(doc); …