0

How do I create a query in feathersjs where I can find all the rows between two timestamps. I am using mysql as the database.

This is what I have so far:

const moment = require("moment");

...

app
.service("bids")
.find({
  query: {
    rate: "official",
    $and: [
      {
        updatedAt: { $gt: moment().subtract(1, "days").startOf("day") },
        updatedAt: { $lt: moment().subtract(1, "days").endOf("day") },
      },
    ],
  },
})

I'd like to find everything between yesterday's 24hours. I have also tried the $or syntax. Somebody help.

1 Answer 1

1

You can apply multiple operators to the same condition:

app
.service("bids")
.find({
  query: {
    rate: "official",
    updatedAt: {
      $gt: moment().subtract(1, "days").startOf("day"),
      $lt: moment().subtract(1, "days").endOf("day")
    }
  },
})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.