Monday, 5 June 2017

sequelize query return Promise { _bitField: ...}

I want to return the value from sequelize query in another variable. I have to tried different solution, but i have the same result:

    Promise {
  _bitField: 2097152,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined,
  _boundTo: SellerPresent }

my js file(at the moment):

function findIdSeller(selectEvent) {
var match = {attribute: ['seller_id'], where: {event_id: selectEvent}, raw: true};
return models.SellerPresent.findAll(match)}

exports.findDataSeller = function (selectEvent) {
    var seller = [];
    return findIdSeller(selectEvent).then(function (result) {
        return  seller.push(result.seller_id)
    })
};

I need export this data in routes. How i can do it?



via Gig90

No comments:

Post a Comment