Skip to content

Instantly share code, notes, and snippets.

@frenchbread
Created October 29, 2016 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frenchbread/d20fc93906c2d4d6f66857e99d5e6f4d to your computer and use it in GitHub Desktop.
Save frenchbread/d20fc93906c2d4d6f66857e99d5e6f4d to your computer and use it in GitHub Desktop.
Example of data buckets logged by emqttd to mongodb
module.exports = [
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_client_connected",
"date" : ISODate("2016-10-19T13:34:30.134Z"),
"client_id" : "C_1476884060951"
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_client_disconnected",
"date" : ISODate("2016-10-19T13:35:01.678Z"),
"client_id" : "C_1476884060951"
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_client_subscribe",
"date" : ISODate("2016-10-19T13:34:30.135Z"),
"client_id" : "C_1476884060951",
"username" : "admin",
"topic_table" : [
{
"$client/C_1476884060951" : [
{
"qos" : 1
}
]
},
{
"$user/%u" : [
{
"qos" : 1
}
]
}
]
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_session_created",
"date" : ISODate("2016-10-19T13:34:30.069Z"),
"client_id" : "C_1476884060951",
"username" : "admin"
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_session_subscribed",
"date" : ISODate("2016-10-19T13:34:30.146Z"),
"client_id" : "C_1476884060951",
"username" : "admin",
"topic_and_opts" : {
"topic" : "$client/C_1476884060951",
"opts" : [
{
"qos" : 1
}
]
}
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_session_terminated",
"date" : ISODate("2016-10-19T13:35:01.679Z"),
"client_id" : "C_1476884060951",
"username" : "admin",
"reason" : "normal"
},
{
"_id" : ObjectId("580776c2831529059100000f"),
"type" : "on_message_publish",
"date" : ISODate("2016-10-19T13:36:02.563Z"),
"message" : {
"id" : "\u0000\u0005?7��Lcp\u0005\u0000\u0000\u0004�\u0000\u0001",
"pktid" : null,
"from" : {
"client_id" : "C_1476884060951",
"username" : "admin"
},
"qos" : 0,
"retain" : false,
"dup" : false,
"topic" : "/World"
}
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_message_delivered",
"date" : ISODate("2016-10-19T13:36:02.565Z"),
"client_id" : "C_1476884060951",
"username" : "admin",
"message" : {
"id" : "\u0000\u0005?7��Lcp\u0005\u0000\u0000\u0004�\u0000\u0001",
"pktid" : null,
"from" : {
"client_id" : "C_1476884060951",
"username" : "admin"
},
"qos" : 0,
"retain" : false,
"dup" : false,
"topic" : "/World"
}
},
{
"_id" : ObjectId("<obj_id>"),
"type" : "on_session_created",
"date" : ISODate("2016-10-19T13:34:30.069Z"),
"client_id" : "C_1476884060951",
"username" : "admin"
},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment