Sails.js populate with where

后端 未结 3 955
难免孤独
难免孤独 2020-12-21 05:18

I need to select users with dogs (pets with type equal \'dog\')

var User = Waterline.Collection.extend({

  identity: \'user\',

  attributes: {         


        
3条回答
  •  孤城傲影
    2020-12-21 06:21

    Did you try this?

    User.find().populate('pets', {
      where: {
        type: 'dog'
      }
    }).exec(err, users)...
    

提交回复
热议问题