From 8901a7d2e2f2b6a77e876bd46dfd0b4563a2c2ea Mon Sep 17 00:00:00 2001 From: bill Date: Mon, 27 Nov 2023 06:02:53 +0000 Subject: [PATCH] update --- mongodb/source/autograder.py | 3 +++ mongodb/source/solution.py | 2 +- neo4j/source/setup.sh | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mongodb/source/autograder.py b/mongodb/source/autograder.py index 30c1eab..fe7d2cf 100644 --- a/mongodb/source/autograder.py +++ b/mongodb/source/autograder.py @@ -25,10 +25,13 @@ def comparator(a, b): return cmp else: return 1 return 0 + from bson import ObjectId match (a, b): case (dict(), dict()): return itcmp([*a.keys(), *a.values()], [*b.keys(), *b.values()]) + case (ObjectId(aa), ObjectId(bb)): + return cmp(aa, bb) case (Iterable(), Iterable()): return itcmp(a, b) case _ if type(a) == type(b): diff --git a/mongodb/source/solution.py b/mongodb/source/solution.py index 457cf01..2229031 100644 --- a/mongodb/source/solution.py +++ b/mongodb/source/solution.py @@ -30,7 +30,7 @@ sols = ['db.bills.find({sponsor_name:"Marco Rubio"}, {_id:0, title: 1, sponsor_n foreignField: "sponsor_state", as:"otherBills"} }, { $unwind: "$otherBills" }, - { $project: {title: 1, sponsor_name: 1, sponsor_state: 1, otherbill_id: "$otherBills._id", otherbill_title: "$otherBills.title", otherbill_sponser_name: "$otherBills.sponsor_name", otherbill_sponsor_state: "$otherBills.sponsor_state"}}, + { $project: {title: 1, sponsor_name: 1, sponsor_state: 1, otherbill_id: "$otherBills._id", otherbill_title: "$otherBills.title", otherbill_sponsor_name: "$otherBills.sponsor_name", otherbill_sponsor_state: "$otherBills.sponsor_state"}}, { $match: {$expr: {$lt: ["$_id", "$otherbill_id"]}}} ])''', '''db.congress.aggregate([ diff --git a/neo4j/source/setup.sh b/neo4j/source/setup.sh index e59eecf..64a1779 100644 --- a/neo4j/source/setup.sh +++ b/neo4j/source/setup.sh @@ -7,4 +7,4 @@ sed -i '1s/^/server.default_listen_address=0.0.0.0\n/' /etc/neo4j/neo4j.conf systemctl enable --now neo4j neo4j-admin dbms set-initial-password 4Sfz541Lm --require-password-change=false -python3 -m pip install neo4j +python3 -m pip install neo4j