Tabnine Logo For Javascript
parse
Code IndexAdd Tabnine to your IDE (free)

How to use parse

Best JavaScript code snippets using parse(Showing top 15 results out of 38,313)

origin: parse-community/parse-server

this.config.database.loadSchema().then(schemaController => schemaController.hasClass(this.className)).then(hasClass => {
   if (hasClass !== true) {
    throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'This user is not allowed to access ' + 'non-existent class: ' + this.className);
   }
  })
origin: parse-community/parse-server

it('should have access to context in beforeFind hook', async () => {
  Parse.Cloud.beforeFind('TestObject', (req) => {
   expect(req.context.a).toEqual('a');
  });
  const query = new Parse.Query('TestObject');
  return query.find({ context: { a: 'a' } });
 });
origin: parse-community/parse-server

it_exclude_dbs(['postgres'])('match exists query', done => {
  const pipeline = [{ match: { score: { $exists: true } } }];
  const query = new Parse.Query(TestObject);
  query.aggregate(pipeline).then(results => {
   expect(results.length).toEqual(4);
   done();
  });
 });
origin: parse-community/parse-server

it_only_db('mongo')('should error on invalid relative time', function (done) {
  const obj1 = new Parse.Object('MyCustomObject', {
   name: 'obj1',
   ttl: new Date(Date.now() + 2 * 24 * 60 * 60 * 1000), // 2 days from now
  });

  const q = new Parse.Query('MyCustomObject');
  q.greaterThan('ttl', { $relativeTime: '-12 bananas ago' });
  obj1
   .save({ useMasterKey: true })
   .then(() => q.find({ useMasterKey: true }))
   .then(done.fail, () => done());
 });
origin: parse-community/parse-server

this.config.database.find('_User', {
    objectId: this.objectId()
   }).then(results => {
    if (results.length != 1) {
     throw undefined;
    }

    if (this.data.password.indexOf(results[0].username) >= 0) return Promise.reject(new Parse.Error(Parse.Error.VALIDATION_ERROR, containsUsernameError));
    return Promise.resolve();
   })
origin: parse-community/parse-server

it('empty acl works', async done => {
  await Parse.User.signUp('tdurden', 'mayhem', {
   ACL: new Parse.ACL(),
   foo: 'bar',
  });

  await Parse.User.logOut();
  const user = await Parse.User.logIn('tdurden', 'mayhem');
  equal(user.get('foo'), 'bar');
  done();
 });
origin: parse-community/parse-server

it('file toJSON testing', async () => {
  const file = new Parse.File('hello.txt', data, 'text/plain');
  ok(!file.url());
  const object = new Parse.Object('TestObject');
  await object.save({
   file: file,
  });
  ok(object.toJSON().file.url);
 });
origin: parse-community/parse-server

it('create a GameScore object', function(done) {
  const obj = new Parse.Object('GameScore');
  obj.set('score', 1337);
  obj.save().then(function(obj) {
   expect(typeof obj.id).toBe('string');
   expect(typeof obj.createdAt.toGMTString()).toBe('string');
   done();
  }, done.fail);
 });
origin: parse-community/parse-server

it('query with limit', function (done) {
  const baz = new TestObject({ foo: 'baz' });
  const qux = new TestObject({ foo: 'qux' });
  Parse.Object.saveAll([baz, qux]).then(function () {
   const query = new Parse.Query(TestObject);
   query.limit(1);
   query.find().then(function (results) {
    equal(results.length, 1);
    done();
   });
  });
 });
origin: parse-community/parse-server

it('purge empty class', done => {
  const testSchema = new Parse.Schema('UnknownClass');
  testSchema
   .purge()
   .then(done)
   .catch(done.fail);
 });
origin: parse-community/parse-server

// This test requires Date objects to be consistently stored as a Date.
 it('time createdAt', function (done) {
  makeThreeTimeObjects().then(function (list) {
   const query = new Parse.Query(TestObject);
   query.greaterThanOrEqualTo('createdAt', list[0].createdAt);
   query.find().then(function (results) {
    equal(results.length, 3);
    done();
   });
  });
 });
origin: parse-community/parse-server

it('first with error', function (done) {
  const query = new Parse.Query(BoxedNumber);
  query.equalTo('$foo', 'bar');
  query
   .first()
   .then(done.fail)
   .catch((e) => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
   .then(done);
 });
origin: parse-community/parse-server

it('does not change inner object key names _p_somethign', done => {
  new Parse.Object('O')
   .save({ innerObj: { _p_data: 7 } })
   .then(object => new Parse.Query('O').get(object.id))
   .then(object => {
    expect(object.get('innerObj')).toEqual({ _p_data: 7 });
    done();
   });
 });
origin: parse-community/parse-server

it('time equality', function (done) {
  makeThreeTimeObjects().then(function (list) {
   const query = new Parse.Query(TestObject);
   query.equalTo('time', list[1].get('time'));
   query.find().then(function (results) {
    equal(results.length, 1);
    equal(results[0].get('name'), 'item2');
    done();
   });
  });
 });
origin: parse-community/parse-server

it('regexes with invalid options fail', function (done) {
  const query = new Parse.Query(TestObject);
  query.matches('myString', 'FootBall', 'some invalid option');
  query
   .find()
   .then(done.fail)
   .catch((e) => expect(e.code).toBe(Parse.Error.INVALID_QUERY))
   .then(done);
 });
parse(npm)

Most used parse functions

  • Cloud
  • Config
  • User
  • ACL
  • ACL.ACL
  • ACL.setPublicReadAccess,
  • ACL.setPublicWriteAccess,
  • ACL.setReadAccess,
  • ACL.setRoleReadAccess,
  • ACL.setRoleWriteAccess,
  • ACL.setWriteAccess,
  • Analytics,
  • Error,
  • FacebookUtils,
  • File,
  • File.File,
  • File._name,
  • File._url,
  • File.addMetadata

Popular in JavaScript

  • colors
    get colors in your node.js console
  • debug
    small debugging utility
  • mocha
    simple, flexible, fun test framework
  • fs-extra
    fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
  • ws
    Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js
  • express
    Fast, unopinionated, minimalist web framework
  • minimist
    parse argument options
  • mongodb
    The official MongoDB driver for Node.js
  • path
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now