-
Notifications
You must be signed in to change notification settings - Fork 55
/
edx.mongo-prune.sh
35 lines (33 loc) · 1.3 KB
/
edx.mongo-prune.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#------------------------------------------------------------------
# written by: McDaniel
# date: apr-2020
#
# usage: Python3 script to delete orphaned JSON documents from MongoDb edxapp
#
# source ~./venv/bin/activate
# ./structures.sh
#
# see:
# - https://discuss.openedx.org/t/mongo-how-to-prune-delete-orphaned-course-data/1811/2
# - https://github.com/edx/tubular/blob/master/scripts/structures.py
#
# sample Mongo command-line connection string:
# mongo --port 27017 -u "admin" -p "<MONGODB ADMIN PASSWORD>" --authenticationDatabase "admin"
#
# MongoDb connection string format:
# "mongodb://myDBReader:D1fficultP%[email protected]:27017/?authSource=admin"
# "mongodb://edxapp:[email protected]/edxapp"
#
# "mongodb://edxapp:<MONGODB ADMIN PASSWORD>@localhost:27017/?authSource=admin"
#------------------------------------------------------------------
## This generates the plan
structures.py --connection="mongodb://admin:<MONGODB ADMIN PASSWORD>@localhost:27017/?authSource=admin" \
--database-name edxapp \
make_plan \
-v DEBUG out.json \
--details details.txt \
--retain 5
### This performs the prune
structures.py --connection="mongodb://admin:<MONGODB ADMIN PASSWORD>@localhost:27017/?authSource=admin" \
--database-name edxapp \
prune out.json