0

I have these two fields in every document in a collection.

"timeOne" : "06-28-2019T22:34:01",
"timeTwo" : ISODate("2019-06-28T22:34:01.870Z")

I would like to get documents that were created in the last 10 minutes in a Node.js function. Could someone help me this Node.js MongoDB query?

Blackwood
  • 4,494
  • 15
  • 30
  • 41
rviDesai
  • 33
  • 1
  • 8

1 Answers1

0

Something like that maybe

col.find({ 
  "timeTwo" : { 
    $gte: moment().add(-20, 'minutes').toISOString()
  }   
})
farvilain
  • 2,418
  • 1
  • 12
  • 24