I have an application created in Node.js with a Rethinkdb database, I load images from the application, but from the Data Explorer, to which you can connect from localhost: 8080, I can not delete the loaded elements.
// This is how I show the elements that the table has Data Explorer
r.db("xxxxxxxxxx").table('images')
// And this is, or that shows
{
"createdAt": Sun Jul 29 2018 16:19:27 GMT+00:00 ,
"id": "17aac165-e885-4278-9cf2-8a71bca65fe3" ,
"publicId": "0IERfW4T5wfcjhFjGNftZh" ,
"src": https:xxxxxxxxxxxxxxxxxxxxxxxx1532881165551.jpg, »
"tags": [ ],
"user": {
"avatar": "www.gravatar.com/avatar/c17a64a79d5bb880c9b002458240fa92" ,
"name": "" ,
"username": "pedrito"
},
"userId": "pedrito"
}
For more than what I check the javascript documentation of Rethinkdb: (https://www.rethinkdb.com/api/javascript/)
I can not find a way to remove the elements of the images from the table one by one. It's there, but I cannot find the way. The most I can see is how to remove users from another table: r.db ("xxxxxxxx"). Table ("users"). Filter (r.row ['username'] = 'pedrito'). delete (). runpero
I can not delete the images in the same way. I want to do it from Data Explorer, from the graphical part of Rethinkdb. Thanks.
r.db("database").table("table").get("document_id").delete()
database, table, and document_id are placeholders
database: The database the table you are trying to delete from is in
table: The table the document you want to delete is in
document_id: The primary key of the document (default id
) that you want to delete
so in this
{
"createdAt": Sun Jul 29 2018 16:19:27 GMT+00:00 ,
"id": "17aac165-e885-4278-9cf2-8a71bca65fe3" ,
"publicId": "0IERfW4T5wfcjhFjGNftZh" ,
"src": https:xxxxxxxxxxxxxxxxxxxxxxxx1532881165551.jpg, »
"tags": [ ],
"user": {
"avatar": "www.gravatar.com/avatar/c17a64a79d5bb880c9b002458240fa92" ,
"name": "" ,
"username": "pedrito"
} ,
"userId": "pedrito"
}
Your primary key is likely ID, so you would use
r.db("xxx").table("images").get("17aac165-e885-4278-9cf2-8a71bca65fe3").delete()
https://rethinkdb.com/api/javascript/#delete
r.db('database').table('table').forEach((entry)=>{
return r.db('database').table('table').get(entry('id')).delete();
});
this will delete absolutely EVERYTHING in the table!
r.db('database').table('table').filter({key:"value"}).forEach((entry)=>{
return r.db('database').table('table').get(entry('id')).delete();
});
This would delete everything in the table where key
: "value".