|
@ -100,15 +100,15 @@ public class MongodbExampleWithSql extends TestCase {
|
100
|
100
|
/**
|
101
|
101
|
* 使用标准SQL查询mongodb
|
102
|
102
|
* 比较符: >,>=,=,<=,<,!=
|
103
|
|
* @desc 当前age列插入的是数值型,如果是字符型,以大于条件为例:where age > '20';
|
104
|
103
|
* @throws Exception
|
105
|
104
|
*/
|
106
|
105
|
public void testExecuteSelectWithCompare() throws Exception {
|
107
|
|
log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age > 20"));
|
108
|
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age = 20"));
|
|
106
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age > 20"));
|
109
|
107
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age < 20"));
|
110
|
108
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age >= 20"));
|
111
|
109
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age <= 20"));
|
|
110
|
//如果collection中的age列插入的数据类型如果是字符型,则等于,不等于条件需分别修改为:where age = '20';where age != '20';
|
|
111
|
log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age = 20"));
|
112
|
112
|
//log.debug("查询结果为:" + noSql.executeSelect("select * from mycol1 where age != 20"));
|
113
|
113
|
}
|
114
|
114
|
|