Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stomping properties. #5

Closed
atheken opened this issue Mar 1, 2010 · 5 comments
Closed

Stomping properties. #5

atheken opened this issue Mar 1, 2010 · 5 comments

Comments

@atheken
Copy link
Owner

atheken commented Mar 1, 2010

Updates should only alter properties that are defined on the document, and should leave other properties untouched when updating.

@doxavore
Copy link

doxavore commented Mar 4, 2010

If you do this, then how do you later add properties to a document?

@atheken
Copy link
Owner Author

atheken commented Mar 4, 2010

sorry, to be clear, if a class definition has this layout:

public class PlainPOCO{
public int ID{get;set;}
public String Name {get;set;}
}

but the database has a property called "CreationDate", updating via norm should not cause that property to be lost..
if I change the definition to include:

public DateTime CreationDate{get;set;}

then it should be handled properly by NoRM, make sense?

@doxavore
Copy link

doxavore commented Mar 4, 2010

That makes sense - I was reading it as the reverse of that. =)

@hyrmn
Copy link
Contributor

hyrmn commented Mar 6, 2010

This feature would be incredibly useful. All you'd need to do is issue an .update(matchDoc, {$set {updateDoc} })

Any elements not in the $set are untouched. Any elements in the $set are replaced/added.

@atheken
Copy link
Owner Author

atheken commented Mar 7, 2010

a simpler approach is to just reflect over what's defined on the class definition and build the spec document based on that. If you could have set it in c# but nulled it, the it should be set to null in the db.

$set/$unset should also be supported, but for different reasons, I think.

@atheken atheken closed this as completed Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants