Reputation: 33
I'm learning firestore recently.
I want to implement below data structure.
- user (document)
- schedules(field, array)
- 0(map)
- startTime(tiemstamp)
- endTime(timestamp)
- 1(map)
- startTime(tiemstamp)
- endTime(timestamp)
I wanted to operate adding a testdata in firestore's GUI. so I created a schedules
(array) and 0
(map)'s data(include startTime and endTime). after that I added 1
(map)'s data(include startTime and endTime). At that moment, 0
(map)'sdata was automatically changed to below data structure.
- 0(map)
- startTime(object)
- nanoseconds(number) (changed to 0)
- seconds(number) (changed to 1550502000)
- endTime(object)
- nanoseconds(number) (changed to 0)
- seconds(number) (changed to 1550504000)
- 1(map)
- startTime(tiemstamp)
- endTime(timestamp)
why timestamp was automatically changed to object?
Please teach me.
Upvotes: 0
Views: 436
Reputation: 3139
I got to reproduce the problem, it seems to be a bug with the Firebase console, not with Firestore itself, because it only happens on the console.
You should report it to Google: https://firebase.google.com/support/contact/
In the meantime, though, what you can do is add the test data through code, using any language that supports the Admin SDK.
Example in Node:
import admin from 'firebase-admin';
admin.initializeApp();
// ...
await admin.firestore().collection('test-date').add({
schedule: [
{
startDate: Timestamp.fromDate(new Date()),
endDate: Timestamp.fromDate(new Date()),
},
{
startDate: Timestamp.fromDate(new Date()),
endDate: Timestamp.fromDate(new Date()),
},
]
});
Upvotes: 1