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

[Feature] Firestore DB needs additional API support to ingest certain data types / formats #7176

Open
somangshu opened this issue Sep 6, 2021 · 9 comments
Labels
BE Coders Pod Issues related to users writing code to fetch and update data Community Reported issues reported by community members Enhancement New feature or request Firestore Issues related to the firestore Integration High This issue blocks a user from building or impacts a lot of users Integrations Pod Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage

Comments

@somangshu
Copy link
Contributor

Description

When the user tries to use unix time stamp moment(EventAddStartDatePicker.selectedDate).unix() in the firestore API, the DB treats is as a map instead of timestamp. Instead when the user tries to use the firestore wrapper to do so, the function works properly admin.firestore.Timestamp(moment(EventAddStartDatePicker.selectedDate).unix(), 0)

The user wants support for the Firestore fields such as references, geocoordinates, etc.

CleanShot_2021-09-06_at_16 04 282x
CleanShot_2021-09-06_at_16 02 292x

Important Details

  • Version: [Cloud / Self-Hosted vx.x]
  • OS: [e.g.MacOSX]
  • Browser [e.g. chrome, safari]
  • Environment [production, release, deploy preview]
@somangshu somangshu added Bug Something isn't working Query Editor Needs Triaging Needs attention from maintainers to triage Firestore Issues related to the firestore Integration labels Sep 6, 2021
@tazmaniax
Copy link

tazmaniax commented Sep 6, 2021

Yes, something like this in the query body might be useful at least for the Timestamp field building a document reference would also be needed. You could then probably get rid of the "Timestamp value path" because that could be done with admin.firestore.FieldValue.serverTimestamp()

{{
{
  "code": EventAddCodeInput.text,
  "title": EventAddTitleInput.text,
  "start": EventAddStartDatePicker.selectedDate ? new admin.firestore.Timestamp(moment(EventAddStartDatePicker.selectedDate).unix(), 0),
  "end": EventAddEndDatePicker.selectedDate ? new admin.firestore.Timestamp(moment(EventAddEndDatePicker.selectedDate).unix(), 0)
  "extPlatform": EventAddExtPlatformSelect.selectedOptionValue,
  "extReference": EventAddExtReferenceInput.text,
  "createdBy": appsmith.user.email,
  "created": admin.firestore.FieldValue.serverTimestamp()
}
}}

@tazmaniax
Copy link

tazmaniax commented Sep 6, 2021

Somewhat related is that Firebase is moving to a more modular API, v9. I wonder if you need to wrap this API to expose it within Appsmith then maybe the new v9 API might make that task easier.

@somangshu
Copy link
Contributor Author

Thanks for the additional info here @tazmaniax

@ajinkyakulkarni ajinkyakulkarni added the Community Reported issues reported by community members label Sep 17, 2021
@tazmaniax
Copy link

This is similar to #3741

@tazmaniax
Copy link

Hi, is there a rough timeline when this might be resolved? thx!

@tazmaniax
Copy link

Now it's Hactoberfest, maybe I need to roll up my sleeves! 😄

@Nikhil-Nandagopal Nikhil-Nandagopal added BE Coders Pod Issues related to users writing code to fetch and update data Mongo Issues related to Mongo DB plugin and removed Mongo Issues related to Mongo DB plugin labels Oct 6, 2021
@nidhi-nair nidhi-nair added the Datatype issue Issues that have risen because data types weren't handled label May 11, 2022
@Nikhil-Nandagopal Nikhil-Nandagopal added Integrations Pod Issues related to a specific integration Data Platform Pod Issues related to the underlying data platform and removed Query Editor labels Sep 12, 2022
@sribalajig sribalajig removed Datatype issue Issues that have risen because data types weren't handled BE Coders Pod Issues related to users writing code to fetch and update data Bug Something isn't working labels Nov 15, 2022
@sribalajig sribalajig removed the Data Platform Pod Issues related to the underlying data platform label Nov 15, 2022
@github-actions github-actions bot added the BE Coders Pod Issues related to users writing code to fetch and update data label Nov 15, 2022
@rohan-arthur rohan-arthur added the High This issue blocks a user from building or impacts a lot of users label Apr 20, 2023
@sumitsum sumitsum changed the title [Bug] Firestore DB needs additional API support to ingest certain data types / formats [Feature] Firestore DB needs additional API support to ingest certain data types / formats May 5, 2023
@Nikhil-Nandagopal Nikhil-Nandagopal added the Enhancement New feature or request label Mar 1, 2024
@GreenFlux
Copy link

Another user is requesting support for Firebase timestamps:
https://discord.com/channels/725602949748752515/1221163808706400317/1221163808706400317

@Naveen-Goud
Copy link

hello @somangshu , I have worked on this task and here are my observations ,
"I observed that the app's data is directly stored in Firestore as a collection without considering data types. This results in collections being improperly displayed in Firestore, as the data is stored as JSON, converted into a hashmap with key-value pairs, and then saved. To address this issue, I created a method that takes the hashmap as input and returns the data with proper data types, allowing it to be saved as expected."
so for that firstl add this code snippet in MethodAddDocument.java

Screenshot from 2024-05-31 15-49-04

Now everything is working fine and here is the screenshot for the example input
Screenshot from 2024-05-31 16-26-01
output
Screenshot from 2024-05-31 16-26-52.

This approach ensures that the data is stored with the appropriate types, improving the readability and integrity of the data in Firestore.

would you please share your thought on this??

thanks

@Naveen-Goud
Copy link

Hello @tazmaniax , I have raised the PR for this task, Could you please review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE Coders Pod Issues related to users writing code to fetch and update data Community Reported issues reported by community members Enhancement New feature or request Firestore Issues related to the firestore Integration High This issue blocks a user from building or impacts a lot of users Integrations Pod Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage
Projects
None yet
Development

No branches or pull requests