How to use the parse.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 attodorov / blast.js / perftest / blast-perf.js View on Github external
it("should be able to observe 10000 rows in no less time than the previous run", function (done) {

		var model = blast.observe(sampleData);

		perf = window._p;
		Parse.initialize("8xnXEIVSc0KBeeDoEHNXKFPwnqQIVHfewNTNKOIO", "vbk4WiXQDzzBF28UQFeTn6tmxsaM73U9i6qDzqAz");
		var TestRun = Parse.Object.extend("TestRun");
		var query = new Parse.Query(TestRun);
		var time = perf["blast.observe"].sum;

		var newTestRun = new TestRun();
		newTestRun.set("key", "observe_100000_rows");
		newTestRun.set("time", time);

		query.find({
			success: function (testRuns) {
				if (!testRuns || testRuns.length === 0) {
					newTestRun.save(null, {
						success: function (run) {
							// pass the test
							done();
						}
					});
				} else {
github petehunt / react-touch / src / data / Content.js View on Github external
getByPageName: function(pageName, defaultContent, cb) {
    var collection = new Content.Collection();
    collection.query = new Parse.Query(Content);
    collection.query.equalTo('pageName', pageName);
    collection.fetch({
      success: function(obj) {
        cb(obj.models[0] || Content.create(pageName, defaultContent));
      },
      error: function(obj, err) {
        console.error('getByPageName() error', obj, err);
      }
    });
  },
github parse-community / ParseReact / demos / AnyBudget / js / Expenses.react.js View on Github external
observe: function() {
    var now = new Date();
    var monthStart = new Date(now.getFullYear(), now.getMonth(), 0, 0, 0);
    var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 0, 0);
    return {
      expenses: (new Parse.Query('Expense'))
                  .greaterThan('createdAt', monthStart)
                  .lessThan('createdAt', monthEnd)
                  .ascending('createdAt')
    };
  },
github beachio / chisel / src / ducks / content.js View on Github external
function requestContentItems(model, items, itemsDraft) {
  return send(getAllObjects(
    new Parse.Query(Parse.Object.extend(model.tableName))
  ))
    .then(items_o => {
      for (let item_o of items_o) {
        let item = new ContentItemData();
        item.model = model;
        item.setOrigin(item_o);
        if (item_o.get('t__owner'))
          itemsDraft.push(item);
        else
          items.push(item);
      }
    })
    .catch(() => {});
}
github beachio / chisel / src / utils / data.js View on Github external
export function getUser(email) {
  if (!email)
    return Promise.reject();
  
  return send(
    new Parse.Query(Parse.User)
      .equalTo("email", email)
      .first()
    )
      .then(user_o => {
        if (user_o)
          return new UserData().setOrigin(user_o);
        else
          throw 'User not found!';
      });
}
github beachio / chisel / src / ducks / models.js View on Github external
function requestTemplates(templates_o, templates) {
  return send(getAllObjects(
    new Parse.Query(TemplateData.OriginClass)
  ))
    .then(_templates_o => {
      Array.prototype.push.apply(templates_o, _templates_o);
      
      for (let template_o of templates_o)
        templates.push(new TemplateData().setOrigin(template_o));
    });
}
github theicfire / bearings / js / main.js View on Github external
var ReactTree = require('./ReactTree');
var Tree = require('./lib/Tree');
var ImportUtils = require('./lib/ImportUtils');
var config = require('./config');
var FakeParseTree = require('./lib/FakeParseTree');

if (config.use_parse) {
	var Parse = require('parse').Parse;
	Parse.initialize(config.parse_app_id, config.parse_js_key);
	var First = Parse.Object.extend('first');
	var query = new Parse.Query(First);
	query.get(config.parse_id, {
		success: function(parseTree) {
			ReactTree.startRender(parseTree);
		},
		error: function(obj, error) {
			throw 'Error loading tree' + obj + error;
		}
	});
} else {
	ImportUtils.opmlToTree(ImportUtils.sampleOpml, function(tree) {
		ReactTree.startRender(new FakeParseTree(Tree.toString(tree)));
	});
}
github beachio / chisel / src / ducks / models.js View on Github external
function requestCollaborationsPre(sites) {
  return send(getAllObjects(
    new Parse.Query(CollaborationData.OriginClass)
      .equalTo("user", Parse.User.current())
  ))
    .then(collabs => {
      for (let collab of collabs)
        sites.push(collab.get('site'));

      return send(Parse.Object.fetchAllIfNeeded(sites));
    });
}
github parse-community / ParseReact / demos / AnyBudget / js / Overview.react.js View on Github external
observe: function() {
    var now = new Date();
    var monthStart = new Date(now.getFullYear(), now.getMonth(), 0, 0, 0);
    var monthEnd = new Date(now.getFullYear(), now.getMonth() + 1, 0, 0, 0);
    return {
      expenses: (new Parse.Query('Expense'))
                  .greaterThan('createdAt', monthStart)
                  .lessThan('createdAt', monthEnd)
                  .ascending('createdAt'),
      user: ParseReact.currentUser
    };
  },
github beachio / chisel / src / ducks / models.js View on Github external
function requestFields(models_o, models) {
  return send(getAllObjects(
    new Parse.Query(ModelFieldData.OriginClass)
      .containedIn("model", models_o)
  ))
    .then(fields_o => {
      for (let field_o of fields_o) {
        let field = new ModelFieldData().setOrigin(field_o);
        let model_o = field_o.get("model");
        for (let model of models) {
          if (model.origin.id == model_o.id) {
            field.model = model;
            model.fields.push(field);
            break;
          }
        }
      }
    });
}