rethinkdb all records are deleted instead of only records matching index -
i have table notifications
. records inserted 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 meeting declined user, must delete associated meeting notifications , send notification null
meeting_id
user notifying them other party has declined 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, notifications in table seem deleted, , im not sure why. there problem query? i'm finding difficult grasp syntax of rethinkdb. using rethinkdb-dash
library stackoverflow won't allow me tag question such.
Comments
Post a Comment