Last active
August 29, 2015 14:03
-
-
Save niraj-shah/cff7e24b4f2df1cc0edb to your computer and use it in GitHub Desktop.
Parse.com JavaScript SDK - DataType Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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