graphql-compose / graphql-compose/graphql-compose-mongoose

feat: Introduce subscription resolvers using Mongoose Watch

Open
#410 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
706
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Can we made it into the core of this tool by using Mongoose Watch

Something like this

```
UserMD.watch().on("change", (data) => {
if (data.operationType === "insert") {
console.log("User inserted: ", data.fullDocument);
}

if (data.operationType === "replace") {
console.log("User updated: ", data.fullDocument);
}

if (data.operationType === "delete") {
// Like here the user was deleted so it's time to detelet his or her information from all the groups.
console.log("User deleted: ", data._id);
}
});
```
This is the most common Mongo DB and GraphQL issue so if this tool solve it like it solved the query long time making then this tool will get a boost up.

_Originally posted by @maheraldous in https://github.com/graphql-compose/graphql-compose-mongoose/issues/409#issuecomment-1169083608_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.