I want to know how to CREATE MySql collections on Meteor, INSERT and UPDATE these collections with the meteor vlasky:mysql package. I know how to publish data to clients with the package and how to subscribe to (SELECT queries) but I want my application to be 100% MySQL. Can anyone help me ? I search on the net but don't have documentation about it.
Well, the README of the package you are referring to states:
For operations other than SELECT, like UPDATE and INSERT, an active node-mysql connection (or pool) is exposed via the LiveMysql.db (or LiveMysql.pool) property.
So this should work:
var post = {id: 1, title: 'Hello MySQL'};
var query = LiveMysql.db.query('INSERT INTO posts SET ?', post, function (error, results, fields) {
if (error) throw error;
// Neat!
});
console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL'