From 7361873eec849daf7a2e367f05c91782c7e265ad Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 13 Mar 2017 02:11:51 +0100 Subject: fix push token invocation --- lib/okpush/db.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/okpush/db.js') diff --git a/lib/okpush/db.js b/lib/okpush/db.js index 09a2c3aa..001c06b5 100644 --- a/lib/okpush/db.js +++ b/lib/okpush/db.js @@ -67,7 +67,7 @@ function addToken (data) { return new PushToken(data).save() } function getAllIOSTokens (channel, cb) { - PushToken.find({ channel: channel, platform: 'ios' }, function (err, items) { + PushToken.distinct("token", { channel: channel, platform: 'ios' }, function (err, items) { if (err) return cb(err, null) var items = _.map(items, function (item) { return item.token @@ -76,7 +76,7 @@ function getAllIOSTokens (channel, cb) { }) } function getAllAndroidTokens (channel, cb) { - PushToken.find({ channel: channel, platform: 'android' }, function (err, items) { + PushToken.distinct("token", { channel: channel, platform: 'android' }, function (err, items) { if (err) return cb(err, null) var items = _.map(items, function (item) { return item.token @@ -85,7 +85,7 @@ function getAllAndroidTokens (channel, cb) { }) } function getAllTokens (channel, cb) { - PushToken.find({ channel: channel }, function (err, items) { + PushToken.distinct("token", { channel: channel }, function (err, items) { if (err) return cb(err, null) var items = _.map(items, function (item) { return _.pick(item, ['platform', 'token']) -- cgit v1.2.3-70-g09d2