Skip to content

Can't push list item with $key #712

@gartmeier

Description

@gartmeier

If I try to create an object with predefined key, firebase returns an error. Is it expected?

let list = af.database.list('/items');
list.push({
    $key: new Date().getTime(),
    name: 'Test'
});
zone.js:390Error: Uncaught (in promise): Error: Firebase.push failed: first argument  contains an invalid key ($key) in property 'items'.  Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"
Error: Firebase.push failed: first argument  contains an invalid key ($key) in property 'items'.  Keys must be non-empty strings and can't contain ".", "#", "$", "/", "[", or "]"

I'm now using the update function instead, but I have no way of evaluating if an item existed before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions