loopbackio / loopbackio/loopback-connector-mongodb
How to register events
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 186
- Forks
- 238
- Avg merge
- 2h 49m
- Merged PRs (30d)
- 1
Description
I want to know how to register these events
```
["timeout",
"close",
"serverOpening",
"serverDescriptionChanged",
"serverHeartbeatStarted",
"serverHeartbeatSucceeded",
"serverHeartbeatFailed",
"serverClosed",
"topologyOpening",
"topologyClosed",
"topologyDescriptionChanged",
"joined",
"left",
"ping",
"ha",
"all",
"fullsetup",]
```
i am registering the events like this
```
client.on("connected", (event) => {
customLogger.info(
`received mongodb connected event ${JSON.stringify(event, null, 2)}`,
);
});
client.on("serverOpening", (event) => {
customLogger.info(
`received "serverOpening": ${JSON.stringify(event, null, 2)}`,
);
});
client.on("serverClosed", (event) => {
customLogger.info(
`received "serverClosed": ${JSON.stringify(event, null, 2)}`,
);
});
client.on("serverDescriptionChanged", (event) => {
customLogger.info(
`received "serverDescriptionChanged": ${JSON.stringify(
event,
null,
2,
)}`,
);
});
client.on("topologyOpening", (event) => {
customLogger.info(
`received "topologyOpening": ${JSON.stringify(event, null, 2)}`,
);
});
client.on("topologyClosed", (event) => {
customLogger.info(
`received "topologyClosed": ${JSON.stringify(event, null, 2)}`,
);
});
client.on("topologyDescriptionChanged", (event) => {
customLogger.info(
`received "topologyDescriptionChanged": ${JSON.stringify(
event,
null,
2,
)}`,
);
});
client.on("serverHeartbeatStarted", (event) => {
customLogger.info(
`received "serverHeartbeatStarted": ${JSON.stringify(event, null, 2)}`,
);
});
client.on("serverHeartbeatSucceeded", (event) => {
customLogger.info(
`received "serverHeartbeatSucceeded": ${JSON.stringify(
event,
null,
2,
)}`,
);
});
client.on("serverHeartbeatFailed", (event) => {
customLogger.info(
`received "serverHeartbeatFailed": ${JSON.stringify(event, null, 2)}`,
);
});
```
but when the connection is established only "Connected" is being triggered and not others
i assume "serverOpening" and "topologyOpening" should also get called as per there description


can someone help me solve/understand this ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the client.on registrations for connected, serverOpening, and topologyOpening and compare them with the connector's documented MongoDB event behavior. Determine whether the missing events are expected or need forwarding, then reproduce the connection sequence and document or test the observed result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, nodejs
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100