Parse & JS: Counting objects

This entry is part 21 of 25 in the series Parse & Javascript

In SQL, we always use select count to get the number of records in a table.

For Parse, we can use the query count function.

<!doctype html>
    <title>My Parse App</title>
    <script type='text/javascript' src=''></script>
    <script type='text/javascript' src=''></script>


    <div style='display:none' class='error'>
        <h1>Movie not found</h1>

    <div style='display:none' class='success'>
        <h1>Movie Found</h1>

    Parse.initialize('5d3sro43zBGj8AMYqWND5bFYMzAan7f5P5euZm7M', 'hlRZZqAylA7Fmah4Kk6ma8WK7QCT4cHrxjafnnkI');
    var MoviObject = Parse.Object.extend('MoviObject');
    var moviObject = new MoviObject();

    var query = new Parse.Query(MoviObject);

    query.equalTo('releaseYear', 2013);

        success: function(count) {
            // The count request succeeded. Show the count
            document.write("No of movies released in the year 2013:  " + count);
        error: function(error) {
            // The request failed

Try The Code
Series Navigation<< Parse & JS: Matching values with containedIn
Parse & JS: Relational data >>

Leave a comment

Leave a Reply