Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
NodeJS MongoDB convert date from string and using in db.collection.find

My expiry field in mongodb is stored as string in format "11 Dec 2021"

So each collection look like this

{
  field1: "Some data"
  expiry: "11 Dec 2021" 
}

I need all collections whose expiry is greater than Dec 31, 2021

If the expiry is of type Date, I can use something like below.

db.collection.find({expiry: {$gt: new Date("31 Dec 2021")}});

But since my expiry is of type String how do I use it? I can do a Array.filter of results but thats not what I am looking for.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!