Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join bsons by network tag and pubkey #23

Closed
pablomendezroyo opened this issue May 14, 2024 · 0 comments · Fixed by #38
Closed

Join bsons by network tag and pubkey #23

pablomendezroyo opened this issue May 14, 2024 · 0 comments · Fixed by #38
Assignees

Comments

@pablomendezroyo
Copy link
Contributor

Join BSON by network tag and pubkey and update the new entries in the same BSON.

filter := bson.M{
    "tag":      req.Tag,
    "network":  req.Network,
    "pubkey":   req.Pubkey,
}

update := bson.M{
    "$push": bson.M{
        "entries": bson.M{
            "payload": req.DecodedPayload.Payload,
            "signature": req.Signature,
        },
    },
}

options := options.Update().SetUpsert(true)

_, err := dbCollection.UpdateOne(context.TODO(), filter, update, options)
if err != nil {
    // Handle error
}

Do not store in db decoded payload

@pablomendezroyo pablomendezroyo changed the title Agroup bsons by network tag and pubkey Join bsons by network tag and pubkey May 14, 2024
@pablomendezroyo pablomendezroyo self-assigned this May 14, 2024
@pablomendezroyo pablomendezroyo linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant