Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

get docs with date intervals mongoose

const moment = require('moment')

const today = moment().startOf('day')

MyModel.find({
  createdAt: {
    $gte: today.toDate(),
    $lte: moment(today).endOf('day').toDate()
  }
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #docs #date #intervals #mongoose
ADD COMMENT
Topic
Name
1+6 =