Comments (6)
Thanks for pointing this out — this is an issue specifically with the latest versions. I neglected to include all the document data in the return of the getDocuments
function. It only returns the fields.
I'll add the timestamps back in soon, but in the meantime here's a workaround using the older version of the library:
If you use Version 8, the get
function (when given a document path) will return all the document information, including its timestamp data and fields. The fields will be typed (e.g. a mapping to a string name: "Name"
will show up in the object as name: { stringValue: "Name" }
.
To unwrap the value document
you get from calling FirestoreApp.get("your/document/path/here", email, key, projectid)
, call FirestoreApp.getFieldsFromFirestoreDocument(document)
.
from firestoregoogleappsscript.
@soitecOpensources In the latest library version (15), that functionality is now available! Added in this commit: eceb6de
from firestoregoogleappsscript.
I'm still not seeing timestamp data. That field returns null
when using getDocuments()
.
from firestoregoogleappsscript.
@LaughDonor Are you using version 15 of the library? I just ran my tests again and saw a timestamp. Here's the code I used:
function test_readDocumentsWithTimestamp() {
const collectionName = "timestamp_test_collection";
const document1 = {
"name": "test one!",
"number": 1
}
const document2 = {
"name": "test two!",
"number": 2
}
firestore.createDocumentWithId("document1", collectionName, document1);
firestore.createDocumentWithId("document2", collectionName, document2);
const docs = firestore.getDocuments(collectionName);
Logger.log(docs);
}
And it logged:
[
{
createTime=2018-05-15T00:04:56.340842Z,
name=projects/xxxxxxxx/databases/(default)/documents/timestamp_test_collection/document1,
updateTime=2018-05-15T00:04:56.340842Z,
fields={
number=1,
name=test one!
}
},
{
createTime=2018-05-15T00:04:56.484303Z,
name=projects/xxxxxxxx/databases/(default)/documents/timestamp_test_collection/document2,
updateTime=2018-05-15T00:04:56.484303Z,
fields={
number=2,
name=test two!
}
}
]
If you are using version 15 of the library, could you send the logs of the returned object from the getDocuments
call?
from firestoregoogleappsscript.
@grahamearley Sorry, I meant the field timestamp typed data was not showing.
from firestoregoogleappsscript.
@LaughDonor Oh, I see what you're saying. Yes, there are still some unimplemented data types. I'll file an issue for getting those implemented.
from firestoregoogleappsscript.
Related Issues (20)
- What is the best way to protect the private key in a container bound script
- Is there anyway to update a nested field but leave other fields unchanged? HOT 1
- Unable to update nested fields with custome mask in updateDocument()
- getDocuments has SyntaxError: Unexpected end of JSON input HOT 3
- Apps script FirestoreApp when query 'collection1' where 'timestampField' == my_variable_Timestamp HOT 1
- Use the count() aggregation
- Queries using != and not-in
- Inserting Weird Values After Updating
- getDocuments() doesn't return the path of each document HOT 1
- Firestore feature missing HOT 1
- Prevent auto conversion to GeoPoint HOT 1
- How do I create a query which compares a value which is inside a map in the document? HOT 1
- README Properties Service key retrieval error HOT 4
- Subcollection being created upon updating Firestore collection HOT 2
- FieldValue support HOT 7
- FieldTransform Support
- "Bad Request" Issue when updating / querying document information HOT 2
- Poor performance when updating thousands of data HOT 8
- Make updateDocument mask default to true
- Accessing specific database HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firestoregoogleappsscript.