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,504
  • 16
  • 32
  • 41
rviDesai
  • 43
  • 2
  • 9

1 Answers1

0

Something like that maybe

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