Skip to content

Instantly share code, notes, and snippets.

View mrfrase3's full-sized avatar
🐦
twerp twerp

Fraser mrfrase3

🐦
twerp twerp
View GitHub Profile
@mrfrase3
mrfrase3 / distinct.js
Last active May 20, 2021 07:24
Feathers JS Mongo/Mongoose distinct hook. (modernised) (secured)
// Updated by mrfrase3, MIT license blah blah: https://gist.github.com/mrfrase3/6f51fb00205a97b44c2ed90b9202a419
// Referenced from: https://github.com/feathersjs-ecosystem/feathers-rest/issues/76#issuecomment-252372915
const { checkContext } = require('feathers-hooks-common');
const { filterQuery } = require('@feathersjs/adapter-commons');
const errors = require('@feathersjs/errors');
const mongoose = require('mongoose');
// exta operators to allow, remove any you want to restrict
const operators = [
@mrfrase3
mrfrase3 / transfer.sh
Last active October 4, 2019 02:46
Transfer Mongo Database Between Servers
#!/bin/bash
# Author: mrfrase3
# run:
# chmod +x ./transfer.sh
# ./transfer.sh <oldURI> <newURI> <oldDBName> <newDBName>
# e.g.
# ./transfer.sh "mongodb://olduser:oldpass@old-server.com/old-db" "mongodb://newuser:newpass@new-server.com/new-db" "old-db" "new-db"