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

NoSQL - write Null to (DateTime-)Fields #464

Closed
frocentus opened this issue Sep 13, 2023 · 1 comment
Closed

NoSQL - write Null to (DateTime-)Fields #464

frocentus opened this issue Sep 13, 2023 · 1 comment
Labels
bug Something isn't working nosql
Milestone

Comments

@frocentus
Copy link

Hello Jesse,

we stumbled today over a Problem. We want to "delete" a LocalDate value from a Document.

According to the NoSQL-Example it should be possible, to do this by writing an null into the LocalDate-Property of the model.
But if look into the Database the DateTime-Value in the Document is still set to the old value and not to "".

So I believe this happens in the org.openntf.xsp.nosql.driver.lsxbe/src/org/openntf/xsp/nosql/communication/driver/lsxbe/util/DominoNoSQLUtil.toDominoFriendly-Method. The null value from the property gets to the else method at the bottom and fails on the null.toString() method.

Would it help to add at the bottom an additional else if for handling null values?

		} else if(value instanceof TemporalAccessor) {
			Instant inst = Instant.from((TemporalAccessor)value);
			DateTime dt = session.createDateTime(Date.from(inst));
			return dt;
		} else if (value == null) {
			return null;
		} else {
			// TODO support other types above
			return value.toString();
		}

In my simple test in a java-agent it wrote the correct "" into the Item.

best regards

Harald

@frocentus frocentus changed the title NoSQL - write Null to Fields NoSQL - write Null to (DateTime-)Fields Sep 13, 2023
@jesse-gallagher jesse-gallagher added bug Something isn't working nosql labels Sep 13, 2023
@jesse-gallagher
Copy link
Member

Ah, so I see. My guess is that it probably skips over any null values in the incoming object, which it shouldn't. I'll look into changing it to remove items that are in the entity object but not in the incoming payload.

@jesse-gallagher jesse-gallagher added this to the 2.14.0 milestone Sep 13, 2023
jesse-gallagher added a commit that referenced this issue Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working nosql
Projects
None yet
Development

No branches or pull requests

2 participants