Skip to content

Commit bb382ee

Browse files
committed
Fix API errors on MQTT/Sparkplug driver.
1 parent 72af3fb commit bb382ee

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

src/mqtt-sparkplug/auto-tag.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ async function AutoCreateTag (data, connectionNumber, rtDataCollection) {
175175
// console.log('>> Insert ' + tag)
176176

177177
let resIns = await rtDataCollection.insertOne(newTag)
178-
// if (resIns.acknowledged) ListCreatedTags.push(tag) // change for mongo driver >= 4.0
179-
if (resIns.insertedCount >= 1) ListCreatedTags.push(tag)
178+
if (resIns.acknowledged) ListCreatedTags.push(tag) // change for mongo driver >= 4.0
180179
else
181180
Log.log(
182181
'Auto Key - Error inserting tag : ' + tag,

src/mqtt-sparkplug/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,8 +2093,7 @@ async function ProcessDeviceCommand(
20932093
}
20942094

20952095
let rIns = await cmdQueue.insertOne(cmd)
2096-
// if (rIns.acknowledged) // change for mongo driver >= 4.0
2097-
if (rIns.insertedCount)
2096+
if (rIns.acknowledged)
20982097
Log.log(
20992098
'MongoDB - Command Queued: ' + JSON.stringify(cmd),
21002099
Log.levelDetailed

src/mqtt-sparkplug/package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)