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

Firestore: FieldValue.increment() feature #7533

Closed
A-Iskakov opened this issue Mar 18, 2019 · 6 comments
Closed

Firestore: FieldValue.increment() feature #7533

A-Iskakov opened this issue Mar 18, 2019 · 6 comments
Assignees
Labels
api: firestore Issues related to the Firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@A-Iskakov
Copy link

Hello,
I have noticed new feature FieldValue.increment() in the latest Firestore SDK for JavaScript
is it possible to add this feature in google-cloud-firestore?
Many thanks!

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Mar 19, 2019
@tseaver tseaver added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: firestore Issues related to the Firestore API. and removed triage me I really want to be triaged. labels Mar 19, 2019
@GuanacoDevs
Copy link

Seems like this is addressed with google-cloud-firestore 1.2.0

@tseaver
Copy link
Contributor

tseaver commented May 17, 2019

@GuanacoDevs Yes, the feature was added in #7989.

@tseaver tseaver closed this as completed May 17, 2019
@binojohnthomas
Copy link

@tseaver - Could you explain how you use this?

u'test_col': firestore.FieldValue.increment(1)

AttributeError: module 'google.cloud.firestore' has no attribute 'FieldValue'

@tseaver
Copy link
Contributor

tseaver commented May 25, 2019

@binojohnthomas It looks like the google.cloud.firestore shim module needs updating (I would recommend not using it myself). Instead, use the firestore_v1 package:

from google.cloud import firestore_v1 as firestore

I have opened #8173 to track updating the shim module.

@A-Iskakov
Copy link
Author

@binojohnthomas as a temp solution you can use this way:
from google.cloud.firestore_v1 import Increment
db = firestore.Client()
doc_ref = db.collection(u'collection_name').document(u'document_name')
doc_ref.set({u'test_col': Increment(1)}, merge=True)

@binojohnthomas
Copy link

@A-Iskakov Thanks - It worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

5 participants