I have connected one mongo db using below connections and I am trying to insert one record/row/document in that db using post method but I am so confused how to do that by below scenario.
"By post method check if the record already present or not if not then create a record"
This is how I made connection and connection successfully made. the fields in dcollection are id, firstname, lastname, student_id
I want to do this.
"By post method check if the record already present or not if not then create a record".
import pymongo
from pymongo import MongoClient
db_name = 'student_db'
client = MongoClient('localhost', 27017)
db_obj = client[db_name]
collection=db_obj['mongo_app_student']