Skip to content

Async getData() returns the value of parent node instead of the child node. #12965

Open
@kahaYu

Description

@kahaYu

Description

Hello!

When I call the async getData() method, it returns the snapshot of the parent, not the actual child.

Reproducing the issue

Create User node and two nodes inside of it: id, name.

  • User
    -- id : testId
    -- name: testName

Call: let userId = try! await Database.database().reference().child("User").child("id").getData().value

It returns 2 key-value pairs id="testId", name="testName". But not the id only.

Firebase SDK Version

10.17.0

Xcode Version

15.1

Installation Method

Swift Package Manager

Firebase Product(s)

Database

Targeted Platforms

iOS

Relevant Log Output

No logs.

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions