Skip to content

Instantly share code, notes, and snippets.

View parkerfoshay's full-sized avatar

Parker Faucher parkerfoshay

View GitHub Profile
# mongod_dba_deploy_replica_set_auth_on_2.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb/2/db
journal:
enabled: true
# mongod_dba_deploy_replica_set_auth_on_1.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb/1/db
journal:
enabled: true
# mongod_dba_reconfig_replica_3.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb/3/db
journal:
enabled: true
# mongod_dba_reconfig_replica_2.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb/2/db
journal:
enabled: true
# mongod_m103_reconfig_replica_1.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb/1/db
journal:
enabled: true
@parkerfoshay
parkerfoshay / lib.sh
Last active March 14, 2023 22:01
instruqt-setup-L4
set -euxo pipefail
echo "Running track setup script"
until [ -f /opt/instruqt/bootstrap/host-bootstrap-completed ]; do
echo "Waiting for instruqt bootstrap to complete"
sleep 1
done
# check if temp dir exists
if [ ! -d /tmp ]; then
@parkerfoshay
parkerfoshay / REPL.sh
Created February 24, 2023 01:26
reconfiguring replica set
rs.conf()
config = rs.config()
config.members[2].priority = 10
rs.reconfig(config)
rs.status()
@parkerfoshay
parkerfoshay / demo.js
Last active December 15, 2022 16:45
mongoose example
const mongoose = require('mongoose');
main().catch(err => console.log(err));
async function main() {
await mongoose.connect(<Atlasconnection-string>);
const userSchema = new mongoose.Schema({
name: {
type: String,
@parkerfoshay
parkerfoshay / L4.js
Created December 6, 2022 22:18
between order by and limit
db.zips.find(
{ state: "NY", pop: { $gte: 1000, $lte: 5000 }},
{_id: 0, state: 1, city: 1, pop: 1}
).sort({pop: -1})
.limit(10)
@parkerfoshay
parkerfoshay / join.js
Created November 23, 2022 21:07
Joins
db.transfers.aggregate( [
{
$lookup:
{
from: "accounts",
localField: "transfer_id",
foreignField: "transfers_complete",
pipeline: [
{ $project: { _id: 0, account_id: 1, account_holder: 1 } }