Vishweswar53
commited on
Commit
•
a01f0a1
1
Parent(s):
6afd275
added initial project
Browse files- .vscode/extensions.json +10 -0
- .vscode/settings.json +8 -0
- .vscode/tasks.json +15 -0
- README.md +15 -1
- main.py +25 -0
- requirements.txt +1 -0
.vscode/extensions.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"recommendations": [
|
3 |
+
"mongodb.mongodb-vscode",
|
4 |
+
"ms-python.python",
|
5 |
+
"ms-toolsai.jupyter",
|
6 |
+
"ms-toolsai.jupyter-keymap",
|
7 |
+
"ms-toolsai.jupyter-renderers",
|
8 |
+
"formulahendry.code-runner"
|
9 |
+
]
|
10 |
+
}
|
.vscode/settings.json
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"workbench.colorTheme": "Default Dark+",
|
3 |
+
"workbench.preferredDarkColorTheme": "Default Dark+",
|
4 |
+
"task.allowAutomaticTasks": "on",
|
5 |
+
"workbench.editorAssociations": {
|
6 |
+
"*.md": "vscode.markdown.preview.editor"
|
7 |
+
}
|
8 |
+
}
|
.vscode/tasks.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"version": "2.0.0",
|
3 |
+
"tasks": [
|
4 |
+
{
|
5 |
+
"label": "Installing extensions and dependencies...",
|
6 |
+
"type": "shell",
|
7 |
+
"command": "code-server --install-extension mongodb.mongodb-vscode --install-extension ms-python.python --install-extension formulahendry.code-runner && pip install -r requirements.txt",
|
8 |
+
"presentation": {
|
9 |
+
"reveal": "always",
|
10 |
+
"panel": "new"
|
11 |
+
},
|
12 |
+
"runOptions": { "runOn": "folderOpen" }
|
13 |
+
}
|
14 |
+
]
|
15 |
+
}
|
README.md
CHANGED
@@ -1 +1,15 @@
|
|
1 |
-
# neurolab-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# neurolab-mongo-python
|
2 |
+
|
3 |
+
![image](https://user-images.githubusercontent.com/57321948/196933065-4b16c235-f3b9-4391-9cfe-4affcec87c35.png)
|
4 |
+
|
5 |
+
### Step 1 - Install the requirements
|
6 |
+
|
7 |
+
```bash
|
8 |
+
pip install -r requirements.txt
|
9 |
+
```
|
10 |
+
|
11 |
+
### Step 2 - Run main.py file
|
12 |
+
|
13 |
+
```bash
|
14 |
+
python main.py
|
15 |
+
```
|
main.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pymongo
|
2 |
+
|
3 |
+
# Provide the mongodb localhost url to connect python to mongodb.
|
4 |
+
client = pymongo.MongoClient("mongodb://localhost:27020/neurolabDB")
|
5 |
+
|
6 |
+
# Database Name
|
7 |
+
dataBase = client["neurolabDB"]
|
8 |
+
|
9 |
+
# Collection Name
|
10 |
+
collection = dataBase['Products']
|
11 |
+
|
12 |
+
# Sample data
|
13 |
+
d = {'companyName': 'iNeuron',
|
14 |
+
'product': 'Affordable AI',
|
15 |
+
'courseOffered': 'Machine Learning with Deployment'}
|
16 |
+
|
17 |
+
# Insert above records in the collection
|
18 |
+
rec = collection.insert_one(d)
|
19 |
+
|
20 |
+
# Lets Verify all the record at once present in the record with all the fields
|
21 |
+
all_record = collection.find()
|
22 |
+
|
23 |
+
# Printing all records present in the collection
|
24 |
+
for idx, record in enumerate(all_record):
|
25 |
+
print(f"{idx}: {record}")
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pymongo
|