Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(connection =>
rethink.table('pipelines')
.orderBy({ index: 'id' })
.map(pipeline =>
pipeline.merge(pipeline =>
({
steps: pipeline('steps').map(step =>
step.merge({
computations: step('computations').map(compId =>
rethink.table('computations').get(compId)
)
})
)
})
)
)
.run(connection).then(res => connection.close().then(() => res))
)
var storeFrames = function (currentGame) {
var winner;
if (currentGame.winner === null) {
winner = '0';
} else {
winner = (currentGame.winner === 'x') ? '1' : '2';
}
currentGame.frames.forEach(function (frame, index, scope) {
scope[index].result = winner;
});
return r.table('bot_stats').insert(currentGame.frames).run(conn);
};
method: function (code, callback) {
R
.table('pings')
.filter({ code: code })
.orderBy(R.desc('timestamp'))
.run(server.app.db, (err, cursor) => {
if (err) {
throw err;
}
cursor.toArray(callback);
});
}
});
socket.on('todo:client:insert', function(todo) {
r.table('Todo').insert(todo).run(connection);
});
method: function (payload, callback) {
R
.table('pings')
.insert(payload)
.run(server.app.db, (err) => {
if (err) {
throw err;
}
callback();
});
}
});
async create(key, value) {
try {
const conn = await this.pool.connect();
const info = await r.table(this.table).insert({
id: key,
value: value
}, {durability: "hard", returnChanges: false}).run(conn);
if (info.inserted != 1) {
throw new Error();
}
return true;
} catch (e) {
this.pool.reset();
throw e;
}
}
async update(key, value) {
.then((conn) => r.table(this.table).run(conn))
.then((cursor) => cursor.toArray())
return r.connect(self.connection).then(function(conn){
return r.table('data').insert(record).run(conn);
})
}
.merge(order => ({
new_val: {
user: r.table('users').get(order('new_val')('userId')).default({}),
reseller: {
contact: r.table('contacts').get(order('new_val')('resellerContactId')).default({}),
company: r.table('resellers').get(order('new_val')('resellerId')).default({}),
},
}
}));
export function getUserByEmail(conn, email) {
return r
.table('users')
.getAll(email, { index: 'email' })
.run(conn)
.then(cursor => cursor.toArray())
.then(user => user[0])
.error(err => err)
}