rethinkdb 检查记录是否存在 [英] rethinkdb check if record exists
本文介绍了rethinkdb 检查记录是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个例子:
r.db('my_db').table('my_table').get('my_record_id_123')
上面的代码工作正常,但返回了记录.这个表中的记录是巨大的.有没有办法检查具有该特定 id 的记录是否存在而不返回记录本身?
The above code works fine, but returns the record. The records in this table are huge. Is there a way to check if the record with that specific id exists or not without returning the record itself?
推荐答案
也许这就是你想要的(如果记录存在则返回 true,否则返回 false):
Perhaps this is what you want (it will return true if the record exists or false otherwise):
r.db('my_db')
.table('my_table')
.getAll('my_record_id_123')
.count()
.eq(1)
这篇关于rethinkdb 检查记录是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文