问题描述
- mysql如何向mongodb转化
-
/**
* 校验用户名是否注册
* @param loginname
* @return
* @throws SQLException
*/
public boolean ajaxValidateLoginname(String loginname) throws SQLException {
String sql = "select count(1) from t_user where loginname=?";
Number number = (Number)qr.query(sql, new ScalarHandler(), loginname);
return number.intValue() == 0;
}/** * 校验Email是否注册 * @param email * @return * @throws SQLException */ public boolean ajaxValidateEmail(String email) throws SQLException { String sql = "select count(1) from t_user where email=?"; Number number = (Number)qr.query(sql, new ScalarHandler(), email); return number.intValue() == 0; } /** * 用户名注册校验 * @param loginname * @return */ public boolean ajaxValidateLoginname(String loginname) { try { return userDao.ajaxValidateLoginname(loginname); } catch (SQLException e) { throw new RuntimeException(e); } } /** * Email校验 * @param email * @return */ public boolean ajaxValidateEmail(String email) { try { return userDao.ajaxValidateEmail(email); } catch (SQLException e) { throw new RuntimeException(e); } } 这是用mysql语法写的,如果用的是mongo该怎么写呢,求教
解决方案
http://www.2cto.com/database/201409/339229.html
解决方案二:
http://www.xue163.com/328/1654/3286149.html
解决方案三:
这不是我想要的啊 我想知道mongodb的写法
时间: 2024-09-19 08:18:05