0
def add_questions(email, classroom, questions):
   print(classroom + "  " + str(questions))
   db.sessions.update_one({ #questions added to session coming up.
       "email": email,
        "status": "on",
        "classroom": classroom
    }, {
        "$set": {
            "questions": questions
        }
    })

https://i.stack.imgur.com/WxxbL.png

That is the structure (in the image).

But it isn't updating? I want to replace the old questions array (as you see in the image) to the new one from my params.

1 Answers1

0

There is no 'classroom' property in the provided document. So the query should look like:

   db.sessions.update_one({
       "email": email,
        "status": "on",
        "class": classroom
    }, {
        "$set": {
            "questions": questions
        }
    })
Oleks
  • 1,633
  • 1
  • 18
  • 22