I figured out how to do this in Morphia. Let me share with others. I
created a generic method for myself. Notice since the field being removed
may no longer be part of the POJO, I am disabling validation both for query
as well as for update-operations.
public <T> void removeField(Class<T> clazz, String fieldName) {
UpdateOperations<T> ops = ds.createUpdateOperations(clazz)
.disableValidation().unset(fieldName);
Query<T> query =
ds.createQuery(clazz).disableValidation().field(fieldName).exists();
UpdateResults<T> updateResults = ds.update(query, ops, false);
}
-Ajay
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user-/***@public.gmane.org
To unsubscribe from this group, send email to
mongodb-user+unsubscribe-/***@public.gmane.org
See also the IRC channel -- freenode.net#mongodb