得到错误Exception in thread "main" java.lang.ClassCastException: com.rethinkdb.net.Cursor$DefaultCursor cannot be cast to java.lang.Boolean
// Login Validation
if (r.db("APSCI").table("BankAccounts").filter(row ->
row.g("username").eq(username).and(row.g("password").eq(password))).run(conn)) {
System.out.print("Welcome /n (username)");
}
else {
System.out.print("No User Was Found!");
}
我正在尝试检查用户名和密码是否对扫描仪的用户输入有效。
不知道Java连接器是如何工作的,但是你可能会发现.coerceTo
很有帮助:
r.db('APSCI').table('BankAccounts')
.getAll(username, {index: 'username'})
.filter({password: password})
.coerceTo('BOOL')
如果序列不为空,则结果为true
,否则为false
。