nodejs-firestore icon indicating copy to clipboard operation
nodejs-firestore copied to clipboard

feat: Implement FieldValue.minimum() and FieldValue.maximum()

Open brettwillis opened this issue 3 months ago • 4 comments

Taking a bit of a liberty here to implement something that touches the public API, but I figure it's simple enough and it's been mentioned that it is on the list but not a high priority, so hopefully this is a help an not a hinderance 🙏🏼

Fixes #1701

brettwillis avatar Mar 18 '24 22:03 brettwillis

Also an off-topic request (it is a backend feature not an SDK feature): It would be create if the backend also supported Timestamps as min/max operands, not just numbers. Would be super useful for incrementing/retaining "createdAt"/"updatedAt" timestamp fields, as an example.

brettwillis avatar Mar 18 '24 22:03 brettwillis

Thanks @brettwillis. At a glance this looks good. I'll do a full review soon. We will have to hold off on releasing this until after April 11th.

MarkDuckworth avatar Mar 19 '24 16:03 MarkDuckworth

Update on this. Since this is a public API change, and one that will also be ported to all Firebase/Firestore SDKs, I have initiated an internal API review for the change.

Also, we're considering alternative names takeMinimum(val) and takeMaximum(val), to give the methods verbs and make them consistent with other FieldValues.

MarkDuckworth avatar Apr 05 '24 16:04 MarkDuckworth

Ok no worries thanks for the update.

brettwillis avatar Apr 05 '24 19:04 brettwillis