$ gte和$ lte in mongoose with multiple condition

时间:2016-10-09 06:14:03

标签: javascript node.js mongodb mongoose

我是否错误地使用1^2 + 2^3 = 9 3^2 + 4^3 = 71 5^2 + 6^3 = 241 7^2 + 8^3 = 561 9^2 + 10^3 = 1081 11^2 + 12^3 = 1849 13^2 + 14^3 = 2913 15^2 + 16^3 = 4321 17^2 + 18^3 = 6121 19^2 + 20^3 = 8361 $gte其他条件?我得到了空数组,但当我$lte时,我能够获得所有数据。

user_email:req.bodu.user_email

1 个答案:

答案 0 :(得分:4)

应该是工作

我刚刚使用这些文档测试

/* 1 */
{
    "_id" : ObjectId("57f9cc3dc4ac279a7c539d0f"),
    "TechActivityId" : 0,
    "LicenseId" : 0,
    "created" : "2016-01-01T00:00:00.000Z",
    "StateofActivity" : "State of Activity",
    "TechGId" : "123121134"
}

/* 2 */
{
    "_id" : ObjectId("57f9e674c4ac279a7c539d10"),
    "TechActivityId" : 0,
    "LicenseId" : 0,
    "created" : "2016-10-10T06:28:37.146Z",
    "StateofActivity" : "State of Activity",
    "TechGId" : "1231234"
}

db.getCollection('hola').find({"created":{"$gte":"2016-01-01T00:00:00.000Z","$lte":"2016-10-10T06:28:37.146Z"}})

我正在获得两个文档