Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by array of values #342

Closed
cajoy opened this issue Oct 23, 2014 · 4 comments
Closed

Filter by array of values #342

cajoy opened this issue Oct 23, 2014 · 4 comments

Comments

@cajoy
Copy link

cajoy commented Oct 23, 2014

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([..., ...])
 }
}
@cajoy
Copy link
Author

cajoy commented Oct 23, 2014

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.

@cajoy
Copy link
Author

cajoy commented Oct 23, 2014

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.

@raymondfeng
Copy link
Contributor

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.

@holbora
Copy link

holbora commented Jul 17, 2016

Hi,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants