Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niraj-shah/cff7e24b4f2df1cc0edb to your computer and use it in GitHub Desktop.
Save niraj-shah/cff7e24b4f2df1cc0edb to your computer and use it in GitHub Desktop.
Parse.com JavaScript SDK - DataType Examples
// string dataType
profile.set( 'bio', 'I am a PHP developer' );
// number dataType
profile.set( 'age', 29 );
// pointer to User class
profile.set( "userId", { "__type": "Pointer", "className": "_User", "objectId": Parse.User.current().id } );
// pointer to custom class
profile.set( "profilePic", { "__type": "Pointer", "className": "ProfilePic", "objectId": 'lq8MSiynEh' } );
// date dataType
var dob = new Date("1985-01-01");
profile.set( 'dob', { "__type": "Date", "iso": dob.toISOString() } );
// geopoint dataType
profile.set( 'location', new Parse.GeoPoint( { latitude: 51.50269506659542, longitude: -0.12497629859615969 } ) );
// array dataType
profile.set( 'hobbies', ['Video Games', 'Table Tennis', 'Squash'] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment