Parse server: How to get exact amount of registered users
I have several millions of users in by database. Is there a way how i can get the exact amount of users registered?
I want to implement a live user registration counter.
The default way is to use the count query from the sdk, but it has limitation to 1000 rows. I need a solution for millions of rows, without any additional indexing or modifications to the DB. Is there such?
parse-server
add a comment |
I have several millions of users in by database. Is there a way how i can get the exact amount of users registered?
I want to implement a live user registration counter.
The default way is to use the count query from the sdk, but it has limitation to 1000 rows. I need a solution for millions of rows, without any additional indexing or modifications to the DB. Is there such?
parse-server
add a comment |
I have several millions of users in by database. Is there a way how i can get the exact amount of users registered?
I want to implement a live user registration counter.
The default way is to use the count query from the sdk, but it has limitation to 1000 rows. I need a solution for millions of rows, without any additional indexing or modifications to the DB. Is there such?
parse-server
I have several millions of users in by database. Is there a way how i can get the exact amount of users registered?
I want to implement a live user registration counter.
The default way is to use the count query from the sdk, but it has limitation to 1000 rows. I need a solution for millions of rows, without any additional indexing or modifications to the DB. Is there such?
parse-server
parse-server
asked Nov 23 '18 at 7:18
lxknvlk
1,3461321
1,3461321
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The 1000 query limit is for the old parse.com server.
On parse-server, this limit has been removed and you can count above 1000.
https://docs.parseplatform.org/js/guide/#counting-objects
You should note that this is an expensive query and you should consider creating an object that stores the total number of users and increases when a new user is created.
You can do this with afterSave triggers
e.g
Parse.Cloud.beforeSave(Parse.User, async(req) => {
if (!req.object.existed()){
const userCount = await new Parse.Query('Statistics').equalTo('name', 'user_count').first({useMasterKey: true});
userCount.increment('count');
userCount.save(null, {useMasterKey: true});
}});
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442196%2fparse-server-how-to-get-exact-amount-of-registered-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The 1000 query limit is for the old parse.com server.
On parse-server, this limit has been removed and you can count above 1000.
https://docs.parseplatform.org/js/guide/#counting-objects
You should note that this is an expensive query and you should consider creating an object that stores the total number of users and increases when a new user is created.
You can do this with afterSave triggers
e.g
Parse.Cloud.beforeSave(Parse.User, async(req) => {
if (!req.object.existed()){
const userCount = await new Parse.Query('Statistics').equalTo('name', 'user_count').first({useMasterKey: true});
userCount.increment('count');
userCount.save(null, {useMasterKey: true});
}});
add a comment |
The 1000 query limit is for the old parse.com server.
On parse-server, this limit has been removed and you can count above 1000.
https://docs.parseplatform.org/js/guide/#counting-objects
You should note that this is an expensive query and you should consider creating an object that stores the total number of users and increases when a new user is created.
You can do this with afterSave triggers
e.g
Parse.Cloud.beforeSave(Parse.User, async(req) => {
if (!req.object.existed()){
const userCount = await new Parse.Query('Statistics').equalTo('name', 'user_count').first({useMasterKey: true});
userCount.increment('count');
userCount.save(null, {useMasterKey: true});
}});
add a comment |
The 1000 query limit is for the old parse.com server.
On parse-server, this limit has been removed and you can count above 1000.
https://docs.parseplatform.org/js/guide/#counting-objects
You should note that this is an expensive query and you should consider creating an object that stores the total number of users and increases when a new user is created.
You can do this with afterSave triggers
e.g
Parse.Cloud.beforeSave(Parse.User, async(req) => {
if (!req.object.existed()){
const userCount = await new Parse.Query('Statistics').equalTo('name', 'user_count').first({useMasterKey: true});
userCount.increment('count');
userCount.save(null, {useMasterKey: true});
}});
The 1000 query limit is for the old parse.com server.
On parse-server, this limit has been removed and you can count above 1000.
https://docs.parseplatform.org/js/guide/#counting-objects
You should note that this is an expensive query and you should consider creating an object that stores the total number of users and increases when a new user is created.
You can do this with afterSave triggers
e.g
Parse.Cloud.beforeSave(Parse.User, async(req) => {
if (!req.object.existed()){
const userCount = await new Parse.Query('Statistics').equalTo('name', 'user_count').first({useMasterKey: true});
userCount.increment('count');
userCount.save(null, {useMasterKey: true});
}});
answered Nov 23 '18 at 7:53
James Falade
6613
6613
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442196%2fparse-server-how-to-get-exact-amount-of-registered-users%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown