diff --git a/Chapter02/Chapter 2.ipynb b/Chapter02/Chapter 2.ipynb index 5799edb..8e7d264 100644 --- a/Chapter02/Chapter 2.ipynb +++ b/Chapter02/Chapter 2.ipynb @@ -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",