- MongoDB Basics
- SQL vs NoSQL
- What is MongoDB?
- What is MongoDB Atlas?
- When to use MongoDB?
- MongoDB data model and data types
- BSON (Binary JSON) data types
- Double
- String
- BSON (Binary JSON) data types
- Object
This file contains 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
# Day 1 | |
sum = 0 | |
File.readlines('day01.txt', chomp: true).each do |line| | |
sum += line.scan(/\d/).values_at(0, -1).join.to_i | |
end | |
puts sum |
This file contains 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
# Title: LightGallery Tag for Jekyll | |
# Authors: Alex Bevilacqua <alex@alexbevi.com> | |
# Description: incorporate the LightGallery inline JavaScript gallery | |
# | |
# Adaption of "Photos tag for Jekyll" by Devin Weaver, and the derived | |
# "Gallery Tag for Jekyll" by Kevin Brown. | |
# | |
# Installation: | |
# | |
# {% gallery_includes %} |
This file contains 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
TODO: | |
☐ [Drivers] Schedule an EMEA/AMER sync @created(21-02-05 06:49) | |
☐ [Drivers] Schedule an Atlas Log Ingestion demo @created(21-02-05 06:49) | |
☐ [sharding] Update TSWRITING-1531 @created(21-01-04 09:58) | |
☐ [Q+I] Research index versions article @created(21-02-05 06:59) | |
☐ [Q+I] https://docs.google.com/document/d/1ba0uGSwcaOilYANjzfNda6wv77yozI3tenGFCUPDM9A/edit @created(21-05-05 12:52) | |
☐ Awaitable ismaster lightning talk @created(21-06-07 16:17) | |
☐ TSWRITING-1912? @created(21-07-05 07:47) | |
☐ Review TSWRITING-1519 @created(21-04-02 09:34) | |
☐ Review Pocket Guide to TimeSeries for Diego @created(21-06-17 09:10) |
This file contains 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
def replace_target(path, target) | |
p = path.split('/') | |
p[-1] = target | |
return p.join('/').to_s | |
end | |
def cleanup_title(c) | |
title = c.gsub('{','').gsub('}','').gsub("\t", ' ').split(', ')[1..-1].join.strip | |
title = title.delete_prefix('"').delete_suffix('"').delete_suffix(' ,').delete_suffix("\",").delete_suffix("\"").delete_suffix("\" ;") | |
title |
This file contains 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
function printReplicationTree(rs) { | |
print("\nReplication Sync Source Tree\n============================"); | |
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } | |
var idMapping = rs.members.reduce((acc, el, i) => { | |
acc[el.name] = i; | |
return acc; | |
}, {}); |
# Use -f/--filename to pass the file to emit JSON for
ruby dump_bson.rb -f auditLog_prod01.bson
....
{"atype":"authenticate","ts":"2020-11-21 06:25:22 UTC","local":{"ip":"127.0.0.1","port":27013},"remote":{"ip":"127.0.0.1","port":55842},"users":[{"user":"__system","db":"local"}],"roles":[],"param":{"user":"__system","db":"local","mechanism":"SCRAM-SHA-1"},"result":0}
{"atype":"shutdown","ts":"2020-11-21 06:25:23 UTC","local":{"ip":"127.0.0.1","port":27013},"remote":{"ip":"127.0.0.1","port":55842},"users":[{"user":"__system","db":"local"}],"roles":[],"param":{},"result":0}
This file contains 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
/* | |
* measureInitialSyncProgress | |
* @author Alex Bevilacqua <alex@alexbevi.com> | |
* @updated 2021-02-23 | |
* | |
* Can be run against a MongoDB 4.2.12+ mongod that is in STARTUP2 (intitial sync) state to gain some | |
* insight into how the sync is progressing based on the improvements introduced with SERVER-47863. | |
* For versions of MongoDB < 4.2.12, see https://www.alexbevi.com/blog/2020/02/13/mongodb-initial-sync-progress-monitoring | |
* | |
* usage: |
This file contains 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
/** | |
* measureIndexUsage(block) | |
* | |
* Measure the index utilization before/after a block is run. The block can contain | |
* one to many operations, however the index utilization will only measure the collections | |
* associated with the current `db` instance. | |
* | |
* NOTE: this script does not "isolate" the operation(s) run so if running in a busy | |
* environment the results may represent other operations index utilization. | |
* |
NewerOlder