i have a table notifications
. records are inserted as so:
socket.on('set notif',function(data){
var user = socket.client.user;
if(typeof user !== 'object' && user == '_srv'){
r.table('notifications').insert(data).run().then(function(res){
r.table('notifications').get(res.generated_keys[0]).run().then(function(data){
var user = data.user_id;
io.sockets.in(user).emit('new notif',data);
});
});
}
});
when a meeting is declined by a user, we must delete all associated meeting notifications and send a notification with a null
meeting_id
to the user notifying them that the other party has declined their offer.
socket.on('del meeting notifs',function(data){
var user = socket.client.user;
if(typeof user !== 'object' && user == '_srv'){
r.table('notifications').getAll(data.id,{index:'meeting_id'}).delete().run().then(function(){
});
}
});
instead, all notifications in the table seem to be deleted, and im not sure why. is there a problem with my query? i'm finding it really difficult to grasp the syntax of rethinkdb. I am using rethinkdb-dash
library but stackoverflow won't allow me to tag this question as such.