Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

Going from the JS docs on Parse.com: https://www.parse.com/docs/js/guide#queries-relational-queries

This is what I presume is the equivalent of what I'm trying to achieve in my set up (with one caveat).

var User = Parse.Object.extend("_User");
var Order = Parse.Object.extend("Order");
var innerQuery = new Parse.Query(User);
var query = new Parse.Query(Order);
query.matchesQuery("user", innerQuery);
query.find({
    success: function(users) {
        // each order has a user. I need the user data associated with that order to retrieve contact info.
    }
});

The reason why I want to use a RESTful call is because of a quirk in the object structure of the Parse response: What is the difference between an id and an objectId for parse.com

I do not want to retrieve all users. I only want to retrieve Users for which I have an Order object. My query only retrieves order objects that have been created that same day.

Below is the

.factory('Order', ['$http', '$q', 'PARSE_HEADERS', 'User', function ($http, $q, PARSE_HEADERS, User) {
    return {
        getSameDay: function(restaurantId) {
            var startDate = new Date(), currentTime = new Date();
            startDate.setHours(8);
            currentTime.getTime();
            startDate.toISOString();
            currentTime.toISOString();
            var deferred = $q.defer();
            $http.get('https://api.parse.com/1/classes/Order', {
                headers: PARSE_HEADERS,
                params: {
                    where: { 'createdAt': { '$gte': startDate, '$lte': currentTime } }
                }
            })
        }
    }
}])

This is the current state of my Order query. Each order has a Pointer field to a User object.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.