Posts

Showing posts with the label mongo

MongoDB tips: using explainable object

This is just to quickly document an alternative way to run explain plan assuming this is the query we want to run explain plan 2019-10-12T06:10:44.366-0400 I COMMAND [conn25251540] command device-event-store.events command: find { find: "events", filter: { $and: [ { aggregateId: { identifier: "990003494014489" } }, { version: { $gte: 0 } } ] }, sort: { version: 1 }, $db: "device-event-store", $clusterTime: { clusterTime: Timestamp(1570875044, 17), signature: { hash: BinData(0, 502D14059FA04824080CA91DAB899D434CFA3E87), keyId: 6727232173650214920 } }, lsid: { id: UUID("91bed447-28f5-4211-b3f8-58821d04060d") } } planSummary: COLLSCAN keysExamined:0 docsExamined:56299 hasSortStage:1 cursorExhausted:1 numYields:441 nreturned:78 reslen:44800 locks:{ Global: { acquireCount: { r: 884 } }, Database: { acquireCount: { r: 442 } }, Collection: { acquireCount: { r: 442 } } } protocol:op_msg 232ms first let's create an explainable object with execut...

MongoDB tip: use --eval and load(), storing executionStats, printjson

This is just a quick note to get the execution stats for a long query. var exp = db.getSiblingDB("device").upDown.explain("executionStats") exp.aggregate([ { $match: { lastModifiedTimestamp: { $lte: new Date(1569297599999) }, deviceId: { $in: [ { identifier: "001924" }, { identifier: "00D645" }, { identifier: "00D646" }, { identifier: "943000017688" }, { identifier: "005605" }, { identifier: "002217" }, { identifier: "00D641" }, { identifier: "004639" }, { identifier: "943000027922" }, { identifier: "004088" }, { identifier: "990003358538110" }, { identifier: "352648065432767" }, { identifier: "358683065700255" }, { identifier: "004888" }, { identifier: "004646" }, { identifier: "943000018098" }, { identifier: "359739074633462" }, { identifier: "352648065428153" }, { identifier: "...

MongoDB tip: mongodb security with user authentication and role assignment, limiting access via mongodb bi connector

Image
This post should be treated as continuation of the previous post on authentication , I will also use mysql workbench to display how this can enhance the access control to mongod via MongoDB BI Connector. Please refer to  this post and/or this post for more information on MongoDB BI Connector. From previous posts, we have created an "admin" user with admin role "root", here is what we had created. minerva-reports:PRIMARY> db.getUser("admin") {         "_id" : "admin.admin",         "user" : "admin",         "db" : "admin",         "roles" : [                 {                         "role" : "root",                         "db" : "admin"                 }        ...