summaryrefslogtreecommitdiff
path: root/lib/okpush/db.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2017-03-13 02:11:51 +0100
committerJules Laplace <jules@okfoc.us>2017-03-13 02:11:51 +0100
commit7361873eec849daf7a2e367f05c91782c7e265ad (patch)
tree40e32fb35c6836b508516f4d90e986de32d38038 /lib/okpush/db.js
parent7cb6b91f674108a73cde7d641b0949e21efdf3b8 (diff)
fix push token invocation
Diffstat (limited to 'lib/okpush/db.js')
-rw-r--r--lib/okpush/db.js6
1 files changed, 3 insertions, 3 deletions
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'])