Parse & JS: Queries on String

Use startsWith to restrict to string values that start with a particular string.

Similar to MySQL LIKE operator, this is indexed so it is efficient for large dataset.

<!doctype html>
<head>
    <title>My Parse App</title>
    <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
    <script type='text/javascript' src='http://www.parsecdn.com/js/parse-1.2.17.min.js'></script>
</head>

<body>

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

    var query = new Parse.Query(MoviObject);

    query.startsWith('titleName', 'Scent');

    query.find(
            {
                success: function (moviObject) {
                    document.write('<h2>Movie Found:</h2>');
                    var title = moviObject[0].get('titleName');
                    document.write(title);
                }
            }
    );
</script>
</body>
</html>
Try The Code

startwith

Series Navigation<< Parse & JS: Return only one object