Skip to content

map().put() #121

@amark

Description

@amark

uggh, when I ran this code:

<html>
    <body>
        <script src="http://rawgit.com/amark/gun/master/gun.js"></script>
        <script>
            localStorage.clear();
            var gun = Gun();

            // define the snake team!
            var snakes = gun.get('team/snakes').put({team: "snakes"});

            // add members to the snake team in one go!
            snakes.path('members')
                .set({name: "alice"}).back
                .set({name: "bob"}).back

            snakes.val(function(theTeam){
                // now add the snake team as a field to each of the members.
                snakes.path('members').map().path('team').put(theTeam);
            });
        </script>
    </body>
</html>

it only added theTeam to the first item it mapped over, not both items it mapped over.

Does this happen constantly?

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