loopback icon indicating copy to clipboard operation
loopback copied to clipboard

Date gt filter not working

Open sreerajkrishnank opened this issue 9 years ago • 3 comments

I am using find query in loopback where I need to filter availabilities based on the start_time. This is the following query I am using app.models.Activity.findOne({ where: { id: req.params.activityName }, include: { relation: 'availabilities', where: {start_time: {'gt': moment().toJSON()}} } })

I also tried where: {start_time: {'gt': Date.now()}} but that's also not working for me and it's returing the whole list. I am using loopback-mongodb connector "loopback-connector-mongodb": "^1.18.1", "loopback": "^3.0.0",

sreerajkrishnank avatar Jul 15 '17 15:07 sreerajkrishnank

@sreerajkrishnank I would first try to make simple case work, for example, something like: https://github.com/strongloop/loopback-datasource-juggler/blob/2.x/test/basic-querying.test.js#L293

      User.find({order: 'seq', where: {birthday: {'gt': new Date('1980-12-08')},

assuming start_timedata type is compatible with new Date()

Setogit avatar Jul 31 '17 18:07 Setogit

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 29 '17 19:09 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Oct 13 '17 20:10 stale[bot]