Skip to content

Instantly share code, notes, and snippets.

View drmirror's full-sized avatar

André Spiegel drmirror

View GitHub Profile
@drmirror
drmirror / update.js
Last active May 7, 2020 15:13
Turn a complex document into an update to another complex document.
/*
For a MongoDB collection, this function turns a nested document
into an update to another document, identifying array elements
by a "_id" field.
For example, given this original document:
{
"_id" : 1,
@drmirror
drmirror / throdel.py
Last active March 6, 2018 21:54
Perform a throttled delete on a MongoDB collection
#!/usr/bin/python
# throdel.py -- perform a throttled delete on a MongoDB collection
# Author: Andre Spiegel
from pymongo import MongoClient
from time import sleep
import argparse
import json
#!/usr/bin/python
# Patches a mongoDB automation configuration to create a new replica set.
# By default, it modifies the file config.json in the current directory,
# saving the original state of that file in config.json.org. You can
# specify a different file to modify using the --file option.
# Author: Andre Spiegel <andre.spiegel@mongodb.com>
import json
@drmirror
drmirror / gist:10392339
Created April 10, 2014 15:10
Keybase proof
### Keybase proof
I hereby claim:
* I am drmirror on github.
* I am drmirror (https://keybase.io/drmirror) on keybase.
* I have a public key whose fingerprint is 2CB0 A5F7 B74F 02CA 119E 00ED E26B 6A93 4587 B69D
To claim this, I am signing this object: