I am new in Rethinkdb and the ReQL api. And I want to know what is the best way of getting the count() of a table after insert() a new row?
This is my actual javascript implementation, but I think it can be improved
r.table('likes')
.changes()
.run(conn)
.then(cursor =>
cursor.each(() => {
r.table('likes')
.count()
.run(conn, (err, result) => console.log(result))
})
})
Then when I add new row
r.table('likes')
.insert({ time: (new Date()).getTime() })
.run(conn)
Thank you for your help!