Loopback-datasource-juggler: Filter by array of values

Created on 23 Oct 2014  路  4Comments  路  Source: loopbackio/loopback-datasource-juggler

I have following records:

{
  "_id": ObjectId("544971f9f144b60000a50bea"),
  "name": "test",
  "description": null,
  "contacts": "Test contacts",
  "url": null,
  "dateList": [
    "2014-11-08T05:00:00.000Z",
    "2014-11-15T05:00:00.000Z"
  ],
  "status": "new",
  "collectionId": ObjectId("54459818953c3c341812df8a"),
  "fileId": null
}

How can I filter by date? possibly with range, something like

Model.find({
 where: {
  dateList: "...."
 }
}

or

Model.find({
 where: {
  dateList: has([..., ...])
 }
}

Most helpful comment

Hi,

For mongoDb there isn't any chance to apply a filter as requested above?

All 4 comments

Or at least what could be database structure so I can get records with exact related date.. Of course I can filter manually but don't want to load all records in memory.

Quick note, for one day I can easily use http://docs.strongloop.com/display/LB/HasManyThrough+relations

But what if I want to filter for date range or selected dates exactly.

Unfortunately, not all DBs allow array types. We store the array value as stringified json for relational DBs. It's not possible to run query against these properties.

Hi,

For mongoDb there isn't any chance to apply a filter as requested above?

Was this page helpful?
0 / 5 - 0 ratings