This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colls = db.getCollectionNames(); | |
var ret = []; | |
colls.forEach(function(coll) { | |
if (String(coll).startsWith("system")) { | |
return; | |
} | |
var indexes = db.getCollection(coll).getIndexes(); | |
var stats = db.getCollection(coll).aggregate( [ { $indexStats: { } } ] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colls = db.getCollectionNames(); | |
var ret = []; | |
colls.forEach(function(coll) { | |
if (String(coll).startsWith("system")) { | |
return; | |
} | |
var indexes = db.getCollection(coll).getIndexes(); | |
var stats = db.getCollection(coll).aggregate( [ { $indexStats: { } } ] ).toArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rl = require("readline"); | |
const FILEPATH = "/Users/Karan.Srivastava/Desktop/Manish Sahni/s1.log"; | |
const OUTPUTFILE = "s1k.log"; | |
const lineReader = rl.createInterface({ | |
input: require("fs").createReadStream(require("path").normalize(FILEPATH)) | |
}) | |
let prevLine = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ClientEncryption } = require('mongodb-client-encryption'); | |
const base64 = require('uuid-base64'); | |
const mongoose = require('mongoose'); | |
// DONOT USE IN PRODUCTION | |
function getEncryptionKey() { | |
const arr = []; | |
for (let i = 0; i < 96; ++i) { | |
arr.push(i); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MongoClient = require("mongodb").MongoClient; | |
const util = require('util') | |
const MONGOURI = "MONGOURL"; | |
const DB = "lever-hire-nurture"; | |
const COLL = "profiles"; | |
const client = new MongoClient(MONGOURI, { useNewUrlParser: true, useUnifiedTopology: true }); | |
client.connect(err => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2020 Kuei-chun Chen. All rights reserved. | |
var cluster = GetClustersSummary() | |
var data = JSON.stringify(cluster); | |
print(data); | |
function GetClustersSummary() { | |
var cluster = { "cluster": "standalone", "databases": [], | |
"keyhole": { "version": "v2.5.0-js", "collected": new Date(), "logs": [] } }; | |
cluster["keyhole"]["logs"].push(new Date().toISOString()+" keyhole.js began"); | |
var doc = db.serverStatus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a ZSTD Collection | |
db.createCollection("COLLNAME", {storageEngine: {wiredTiger: {configString: "block_compressor=zstd"}}}) | |
// Check which block compressor is being used for a collection | |
var wt_options = db.zlogs.stats().wiredTiger.creationString.split(',') | |
// filter the options | |
wt_options.filter((wt_options) => wt_options.startsWith('block_compressor')) |
OlderNewer