Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions Chapter02/Chapter 2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1812,14 +1812,70 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"using Mongoc"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"client = Mongoc.Client(\"mongodb://localhost:27017\") #assuming Mongodb is running at port 27017"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"storage = client[\"db\"][\"dataframes\"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"datadict = JSON.parse(JSON.json(test_data))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"datadict[\"id\"] = \"iris_test_data\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"push!(storage, Mongoc.BSON(datadict))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"data_from_mongo = first(Mongoc.find(storage, Mongoc.BSON(\"\"\" {\"id\" : \"iris_test_data\" } \"\"\")))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.0.1",
"display_name": "Julia 1.5.2",
"language": "julia",
"name": "julia-1.0"
"name": "julia-1.5"
},
"language_info": {
"file_extension": ".jl",
Expand Down