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

129
Views
Query by date string in MongoDB?

I have a string field in a collection which stores date in this format 3 Mar 2022. Is there anyway to apply $gt and $lt operators on this in the query? Or is there any other way to query this field? I am using nodejs/mongoose for querying. Schema sample

export const SampleSchema = new EntitySchema(
    {
        startValidity: { type: String },
        endValidity: { type: String },
    },
    { collection: 'Sample'},
)

Please help.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if your date field is of type date, then you can query like

{ $and: [{ myDateField: { $gte: myDateQuery1} }, { myDateField: { $lte: myDateQuery1} }] }
about 4 years ago · Juan Pablo Isaza Report
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!