MongoDB 里面日期查询的问题
2014-07-04 18:12
148 查看
http://www.v2ex.com/t/80624
问题:
原生控制台查不到结果,用Java驱动可以。MongoDB shell version: 2.4.6
具体情况是:
DB:ecommerce, Collection为products,
1.shell命令查不出来结果:
use ecommerce
db.products.find({ "manufacture_details.release_date" : { "$gte" : { "$date" : "2012-05-17T08:14:15.000Z"}}});
2.但是用Java MongoDB Driver 查询,就可以出来,
trace info 显示:find: ecommerce.products { "manufacture_details.release_date" : { "$gte" : { "$date" : "2012-05-17T08:14:15.000Z"}}}
可以查到结果。
3. 用 这种shell命令可以查询到结果:
use ecommerce
db.products.find({"manufacture_details.release_date": {"$gte": new ISODate("2012-05-17 08:14:15.656")}});
但是本人不需要3这种写法,想把1这种写法调通,
测试数据:
mongo
use ecommerce
db.products.insert({
sku: "111445GB3",
title: "Simsong One mobile phone",
description: "The greatest Onedroid phone on the market .....",
manufacture_details: {
model_number: "A123X",
release_date: new ISODate("2012-05-17T08:14:15.656Z")
},
shipping_details: {
weight: 350,
width: 10,
height: 10,
depth: 1
},
quantity: 99,
pricing: {
price: 1000
}
})
==============
问题:
原生控制台查不到结果,用Java驱动可以。MongoDB shell version: 2.4.6
具体情况是:
DB:ecommerce, Collection为products,
1.shell命令查不出来结果:
use ecommerce
db.products.find({ "manufacture_details.release_date" : { "$gte" : { "$date" : "2012-05-17T08:14:15.000Z"}}});
2.但是用Java MongoDB Driver 查询,就可以出来,
trace info 显示:find: ecommerce.products { "manufacture_details.release_date" : { "$gte" : { "$date" : "2012-05-17T08:14:15.000Z"}}}
可以查到结果。
3. 用 这种shell命令可以查询到结果:
use ecommerce
db.products.find({"manufacture_details.release_date": {"$gte": new ISODate("2012-05-17 08:14:15.656")}});
但是本人不需要3这种写法,想把1这种写法调通,
测试数据:
mongo
use ecommerce
db.products.insert({
sku: "111445GB3",
title: "Simsong One mobile phone",
description: "The greatest Onedroid phone on the market .....",
manufacture_details: {
model_number: "A123X",
release_date: new ISODate("2012-05-17T08:14:15.656Z")
},
shipping_details: {
weight: 350,
width: 10,
height: 10,
depth: 1
},
quantity: 99,
pricing: {
price: 1000
}
})
==============
相关文章推荐
- 关于《一个SQL语句查询问题(查询最小值)(急)》回复里面没有正确理想的答案!
- Hibernate查询oracle中日期的右边界问题
- sql日期查询问题
- 转-HTC 手机生产日期,产地查询 以及 SN码 IMEI码 查询等问题汇总
- 转-HTC 手机生产日期,产地查询 以及 SN码 IMEI码 查询等问题汇总
- 由于查询语句中日期的格式引起的问题
- 关于SQL中Between语句查询日期的问题
- QT+sqlite3 日期查询问题
- 关于oracle日期查询问题
- 转-HTC手机生产日期,产地查询以及SN码IMEM码查询等问题汇总
- 关于对日期类型的数据进行模糊查询的问题
- 数据库查询问题-日期格式
- 多个表联合查询的一些问题解决,用一个表里面的查询结果来排除另外一个表的查询结果
- sql日期查询问题
- SQL日期查询中的典型问题
- 日期条件查询 问题解决
- 群里面看到的一个sql查询的问题
- 由于查询语句中日期的格式引起的问题
- 关于Mongodb查询不存在的字段时的问题
- 一个有意思的问题:如何根据一年中的第几周,查询出它周六和周日对应的日期