Debugger Debugger - 3 years ago 217
Android Question

Parse ANDROID SDK is not allowing to delete and returns [MongoError: exception: Mod on _id not allowed] in the log

Parse android sdk does not allow to update a column in the user table
While I am using getCurrentUser() method to mark it as authenticated but when I call save on it. it gives me the error in the log file that

Uncaught internal server error. { [MongoError: exception: Mod on _id not allowed]
name: 'MongoError'

below is my code i am using for saving

byte[] data = "Working at Parse is great!".getBytes();
final ParseFile file = new ParseFile("abcdef.txt", data);

ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
// do stuff with the user
currentUser.put("column_name", file);
currentUser.saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e == null) {
Log.i("KQ", "update successfully");
} else {
Log.i("KQ", "update error e = " + e);
} else {
// show the signup or login screen
Log.i("KQ", "else");

Answer Source

Till I get a good answer.I am currently using my cloud code beforeSave trigger in parse to remove the id field to get rid of the exception and unblock my work. any good answer will still be appreciated.

code I am using right now is as follows in the cloud code.

Parse.Cloud.beforeSave(Parse.User, function(request, response) {
    // For Android SDK remove id field while updating a user becasue it was creating MongoDB Exception in android.
    if (request.object.get("updatedFrom") == 'android') {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download