简体   繁体   中英

find data between two dates in Mongodb + php

my collection structure is

"classStartDate" : ISODate("2018-04-26T00:00:00.000Z") in mongo db,

now I am searching record between 2018-01-01 to 2018-07-31, My code is

$where = array( "classStartDate"    => array('$gte'=>$mongostartdate), "classEndDate"      => array('$lte'=>$mongoenddate));

but no result found, Pls help

CollectionName.find({
    created_at: {
        $gte:$mongostartdate,
        $lt: mongoenddate
    }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM