Skip to content

Correct usage of restore when date is within array of objects #50

@evallgar

Description

@evallgar

Hi there!

I would like to ask how to correctly use restore for date timestamp when data looks like this:

 "wFLrjgdW7Jjmjs5sX": {
  "_id": "wFLrjgdW7Jjmjs5sX",
  "notifications": [
    {
      "date": {
        "_seconds": 1589998976,
        "_nanoseconds": 490000000
      },
      "type": "new",
      "message": "Contract has been created.",
      "user": "Philip Rawsen"
    },
    {
      "date": {
        "_seconds": 1589999521,
        "_nanoseconds": 985000000
      },
      "type": "payment",
      "message": "Customer payment for USD $ 67.92",
      "user": "Lena Perks"
    }
  ]
}

When I use the command

// Start exporting your data
firestoreService
  .restore(`./collections/${collectionName}.json`, {
    dates: ['notifications.date']
  });

I cannot get it to restore it as a timestamp. It restores as a map field.
I have also tried with 'notifications[].date' and simply 'date' unsuccessfully.

Any help is greatly appreciated. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions