javascriptnode.jssails.jswaterline

Waterline, find array in array


I have Video model:

module.exports = {

  attributes: {
    id: 'string',
    tags: 'array'
  },
}

I want to find all videos with tags for example "Hello" or "World". I could easy get all videos like: Video.find({tags:"Hello"}). I saw examples where searching id: [1,2,3] but not when key(id => tags) is array.


Solution

  • try this:

    Video.find({tags: {"$in" : ["sometag1", "sometag2"]}})