google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

disableValidation causes className to go in update params #379

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? morphia-0.99.1-SNAPSHOT.jar / mongo 2.0.1

Doing an update w/ disableValidation causes the update to get the className 
parameter inserted.

For example, this code
        Notification notification = new Notification("xyz");
        Query<User> query =
createQuery().field("_id").equal(user.getId());
        UpdateOperations<User> ops =
createUpdateOperations().disableValidation()
            .removeAll("notifications", notification);
        UpdateResults<User> results = update(query, ops);

gives this mongo statement:
    { $pull: { notifications: { className: "com.example", abc: "xyz" } } }

however, this code:
        Notification notification = new Notification("xyz");
        Query<User> query =
createQuery().field("_id").equal(user.getId());
        UpdateOperations<User> ops = createUpdateOperations()
            .removeAll("notifications", notification);
        UpdateResults<User> results = update(query, ops);

gives this mongo statement:
    { $pull: { notifications: { abc: "xyz" } } } 

Original issue reported on code.google.com by mike.lev...@teamaol.com on 16 Feb 2012 at 12:44