generated from kalanakt/Pyrogram-Telegram-Bot-Template
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
336 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from pymongo import MongoClient | ||
|
||
# Replace <username>, <password>, and <cluster-name> with your own values | ||
client = MongoClient( | ||
"mongodb+srv://ktu:[email protected]/?retryWrites=true&w=majority") | ||
db = client.database | ||
collection = db.utube_collection | ||
|
||
|
||
def u_video(video_data, video): | ||
post = {"video_data": video_data, "video": video} | ||
result = collection.insert_one(post) | ||
# This will print the ID of the inserted document | ||
return result.inserted_id | ||
|
||
|
||
def get_u_video(video_data): | ||
query = {"video_data": video_data} | ||
|
||
# Find documents with the given title | ||
results = collection.find(query) | ||
|
||
# Print the results | ||
for result in results: | ||
return result | ||
|
||
|
||
def delete_u_video(video_data): | ||
query = {"video_data": video_data} | ||
collection.delete_one(query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.