mongodb you can't add a second
问题信息:
Due to limitations of the com.mongodb.BasicDBObject, you can't add a second 'createTime' expression specified as 'createTime : { "$lt" : 1468339200000}'. Criteria already contains 'createTime : { "$gt" : 1468252800000}'.
------------------------之前代码----------------------------------------
if(endTime!=null){
endTime = DateUtil.getEndOfDay(endTime);
}
if (startTime !=null) {
criteria.and("createTime").gte(startTime);
}
if(endTime!=null){
criteria.and("createTime").lte(endTime);
}
------------------------修改代码----------------------------------------
if(endTime!=null){
endTime = DateUtil.getEndOfDay(endTime);
}
if (startTime !=null&&endTime==null) {
criteria.and("createTime").gte(startTime);
}else if(startTime==null&&endTime!=null){
criteria.and("createTime").lte(endTime);
}else if(startTime!=null&&endTime!=null){
criteria.andOperator(
Criteria.where("createTime").gte(startTime),
Criteria.where("createTime").lte(endTime)
);
}
mongodb you can't add a second的更多相关文章
- 搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展
上一篇:搭建LNAMP环境(五)- PHP7源码安装Redis和Redis拓展 一.安装MongoDB 1.创建mongodb用户组和用户 groupadd mongodb useradd -r -g ...
- mrjob 使用 mongodb 作为数据源
When using a mongoDB collection as input, add the arguments -jobconf mongo.input.uri=<input mongo ...
- mongodb 操作类
在使用这个类之前,建议先自己去写,把方法都了解了再用,这样你就可以在适当的时候修个此类,另外请自己构建PagerInfo using System; using System.Collections. ...
- mongoDB操作命令及mongoDB的helper
此项目已开源,开源地址是: http://mongodbhelper-csharp.googlecode.com/svn/trunk/ mongodb的helper using System; usi ...
- MongoDB - Introduction to MongoDB, Documents
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...
- node.js零基础详细教程(7):node.js操作mongodb,及操作方法的封装
第七章 建议学习时间4小时 课程共10章 学习方式:详细阅读,并手动实现相关代码 学习目标:此教程将教会大家 安装Node.搭建服务器.express.mysql.mongodb.编写后台业务逻辑. ...
- PHP7源码安装MongoDB和MongoDB拓展
一.安装MongoDB 1.创建mongodb用户组和用户 groupadd mongodb useradd -r -g mongodb -s /sbin/nologin -M mongodb 2.下 ...
- ASP.NET Core 实战:使用 NLog 将日志信息记录到 MongoDB
一.前言 在项目开发中,日志系统是系统的一个重要组成模块,通过在程序中记录运行日志.错误日志,可以让我们对于系统的运行情况做到很好的掌控.同时,收集日志不仅仅可以用于诊断排查错误,由于日志同样也是大量 ...
- MongoDB 菜鸟入门“秘籍”
1.MongoDB介绍 1.1 什么是MongoDB ? MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统. 在高负载的情况下,添加更多的节点,可以保证服务器性能. Mo ...
随机推荐
- 9 python 数据类型—字典
字典是python中唯一的映射类型,采用键值对(key-value)的形式存储数据.python对key进行哈希函数运算,根据计算的结果决定value的存储地址,所以字典是无序存储的,且key必须是可 ...
- 【HDU 6428】Calculate 莫比乌斯反演+线性筛
题解 代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1LL&l ...
- log4net初探
/// <summary> /// Static constructor that initializes logging by reading /// settings from the ...
- 洛谷【P1601】A+B Problem(高精)
题目传送门:https://www.luogu.org/problemnew/show/P1601 高精度加法板子.我们灵性地回忆一波小学学加法列竖式的场景(从\(6\)岁开始口算从未打过草稿的大佬请 ...
- C#中如何设置日期格式
在C#中,ToShortDateString()是用于显示短日期格式的方法,如果使用下面的语句: Label1.Text = DateTime.Now.ToShortDateString(); 那么, ...
- Python脚本开头两行:#!/usr/bin/python和# -*- coding: utf-8 -*-的作用
转于:https://www.crifan.com/python_head_meaning_for_usr_bin_python_coding_utf-8/ 出处:在路上 一.基本功能 1)#!/us ...
- 【转】 Pro Android学习笔记(四八):ActionBar(1):Home图标区
目录(?)[-] Home Icon 源代码 TextView的滚动 返回主activity或指定activity ActionBar在Android 3.0 SDK中为平板引入,在4.0中也 ...
- unittest单元测试生成HTML测试报告
前言: HTMLTestRunner 是 Python 标准库的 unittest 模块的一个扩展,它可以生成 HTML的 测试报告. 一.下载HTMLTestRunnerNew.py文件: 下载链接 ...
- Java enum(枚举)使用详解之三
DK1.5引入了新的类型——枚举.在 Java 中它虽然算个“小”功能,却给我的开发带来了“大”方便. 用法一:常量 在JDK1.5 之前,我们定义常量都是: publicstaticfianl... ...
- nmap 快速扫描所有端口
nmap -sT -sV -Pn -v xxx.xxx.xxx.xxx nmap -sS -p 1-65535 -v 192.168.1.254参数:-sS TCP SYN扫描 nmap ...