How to use the parse/node.Parse.Query function in parse

To help you get started, we’ve selected a few parse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github blackbaud / barkbaud / server / api-dogs.js View on Github external
function getPreviousHomes(request, response) {
        var queryDog = new Parse.Query('Dog'),
            queryOwnerHistory = new Parse.Query('DogOwnerHistory'),
            currentOwner;

        // Get the requested dog
        queryDog.include('currentOwner');
        queryDog.get(request.params.dogId, {
            success: function (dog) {

                currentOwner = dog.get('currentOwner');
                if (currentOwner) {
                    queryOwnerHistory.notEqualTo('objectId', currentOwner.id);
                }

                // Get the owner history tied to this dog
                queryOwnerHistory.equalTo('dog', dog);
                queryOwnerHistory.descending('fromDate');
github autoai-org / AID / components / discovery / src / parse / index.ts View on Github external
async function getCount(limit: number) {
    const Meta = Parse.Object.extend('Meta');
    const query = new Parse.Query(Meta);
    query.descending('createdAt');
    query.limit(limit);
    const results: any[] = await query.find();
    const result: CountResult[] = [];
    for (let i = 0; i < results.length; i++) {
        const pojo_result: PojoResult = results[i].toJSON();
        const each_result: CountResult = {
            user: pojo_result.user,
            model: pojo_result.model,
            registry: pojo_result.registry,
            updatedAt: pojo_result.updatedAt,
        };
        result.push(each_result);
    }
    return result;
}
github parse-community / parse-server / spec / schemas.spec.js View on Github external
.then(() => {
        const query = new Parse.Query('AClass');
        return query.find();
      })
      .then(results => {
github parse-community / parse-server / spec / schemas.spec.js View on Github external
.then(() => {
        const query = new Parse.Query('AnObject');
        return query.find();
      })
      .then(results => {
github blackbaud / barkbaud / server / api-dogs.js View on Github external
function getNotes(request, response) {

        var queryDog = new Parse.Query('Dog'),
            queryNotes = new Parse.Query('DogNotes');

        queryDog.get(request.params.dogId, {
            success: function (dog) {
                queryNotes.equalTo('dog', dog);
                queryNotes.find({
                    success: function (notes) {
                        response.json({
                            data: notes
                        });
                    },
                    error: function (notes, error) {
                        onParseError(response, error);
                    }
                });
            },
github blackbaud / barkbaud / server / api-dogs.js View on Github external
function getNotes(request, response) {

        var queryDog = new Parse.Query('Dog'),
            queryNotes = new Parse.Query('DogNotes');

        queryDog.get(request.params.dogId, {
            success: function (dog) {
                queryNotes.equalTo('dog', dog);
                queryNotes.find({
                    success: function (notes) {
                        response.json({
                            data: notes
                        });
                    },
                    error: function (notes, error) {
                        onParseError(response, error);
                    }
                });
            },
            error: function (dog, error) {
github parse-community / parse-server / spec / ParseServerRESTController.spec.js View on Github external
.then(user => {
        expect(user.sessionToken).toBeUndefined();
        const query = new Parse.Query('_Session');
        return query.find({ useMasterKey: true });
      })
      .then(sessions => {
github parse-community / parse-server / spec / ParseServerRESTController.spec.js View on Github external
await RESTController.request('POST', 'batch', {
          requests: [
            {
              method: 'POST',
              path: '/1/classes/MyObject3',
              body: { key: 'value1' },
            },
            {
              method: 'POST',
              path: '/1/classes/MyObject3',
              body: { key: 'value2' },
            },
          ],
        });

        const query = new Parse.Query('MyObject');
        const results = await query.find();
        expect(results.map(result => result.get('key')).sort()).toEqual([
          'value1',
          'value2',
        ]);

        const query2 = new Parse.Query('MyObject2');
        const results2 = await query2.find();
        expect(results2.length).toEqual(0);

        const query3 = new Parse.Query('MyObject3');
        const results3 = await query3.find();
        expect(results3.map(result => result.get('key')).sort()).toEqual([
          'value1',
          'value2',
        ]);
github parse-community / parse-server / spec / schemas.spec.js View on Github external
.then(() => {
        const query = new Parse.Query('AnObject');
        query.include('anotherObject');
        return query.find();
      })
      .then(res => {
github parse-community / parse-server / spec / ParseServerRESTController.spec.js View on Github external
},
          ],
        });

        const query = new Parse.Query('MyObject');
        const results = await query.find();
        expect(results.map(result => result.get('key')).sort()).toEqual([
          'value1',
          'value2',
        ]);

        const query2 = new Parse.Query('MyObject2');
        const results2 = await query2.find();
        expect(results2.length).toEqual(0);

        const query3 = new Parse.Query('MyObject3');
        const results3 = await query3.find();
        expect(results3.map(result => result.get('key')).sort()).toEqual([
          'value1',
          'value2',
        ]);

        expect(databaseAdapter.createObject.calls.count()).toBe(13);
        let transactionalSession;
        let transactionalSession2;
        let myObjectDBCalls = 0;
        let myObject2DBCalls = 0;
        let myObject3DBCalls = 0;
        for (let i = 0; i < 13; i++) {
          const args = databaseAdapter.createObject.calls.argsFor(i);
          switch (args[0]) {
            case 'MyObject':