sourceName stringclasses 1
value | url stringclasses 20
values | action stringclasses 1
value | body stringlengths 23 1.11k | format stringclasses 1
value | metadata dict | title stringclasses 20
values | updated stringclasses 1
value | embedding listlengths 384 384 |
|---|---|---|---|---|---|---|---|---|
devcenter | https://www.mongodb.com/developer/products/mongodb/build-go-web-application-gin-mongodb-help-ai | created | [4]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/blta325fcc27ed55546/651482786fefa7183fc43138/image7.png
[5]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/bltc8029e22c4381027/6514880ecf50bf3147fff13f/A7n71ej.gif
[6]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/blt43... | md | {
"tags": [
"MongoDB",
"Go"
],
"pageDescription": "Learn how to build a web application with the Gin framework for Go and MongoDB using the help of Cody AI from Sourcegraph.",
"contentType": "Tutorial"
} | How to Build a Go Web Application with Gin, MongoDB, and with the Help of AI | 2024-05-20T17:32:23.500Z | [
-0.02919306606054306,
0.014891638420522213,
0.024003518745303154,
-0.010366319678723812,
0.034340303391218185,
0.019679617136716843,
0.004534272477030754,
0.022148190066218376,
-0.006425179075449705,
-0.03987327218055725,
0.020153438672423363,
-0.07984752207994461,
0.03557003661990166,
0.0... |
devcenter | https://www.mongodb.com/developer/products/mongodb/build-go-web-application-gin-mongodb-help-ai | created | [7]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/bltd6759b52be548308/651482b2d45f2927c800b583/image3.png
[8]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/bltfc8ea470eb6585bd/651482da69060a5af7fc2c40/image5.png
[9]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/blte5d... | md | {
"tags": [
"MongoDB",
"Go"
],
"pageDescription": "Learn how to build a web application with the Gin framework for Go and MongoDB using the help of Cody AI from Sourcegraph.",
"contentType": "Tutorial"
} | How to Build a Go Web Application with Gin, MongoDB, and with the Help of AI | 2024-05-20T17:32:23.500Z | [
-0.044189319014549255,
-0.010568817146122456,
0.033681418746709824,
-0.014799040742218494,
0.038115814328193665,
0.018738053739070892,
-0.007383090443909168,
0.026860078796744347,
0.004617145750671625,
-0.034826673567295074,
0.017833849415183067,
-0.09220899641513824,
0.04585318639874458,
... |
devcenter | https://www.mongodb.com/developer/products/mongodb/build-go-web-application-gin-mongodb-help-ai | created | [10]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/bltc2467265b39e7d2b/651483038f0457d9df12aceb/image6.png
[11]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/blt972b959f5918c282/651483244f2fa81286699c09/image1.png
[12]: https://images.contentstack.io/v3/assets/blt39790b633ee0d5a7/blt... | md | {
"tags": [
"MongoDB",
"Go"
],
"pageDescription": "Learn how to build a web application with the Gin framework for Go and MongoDB using the help of Cody AI from Sourcegraph.",
"contentType": "Tutorial"
} | How to Build a Go Web Application with Gin, MongoDB, and with the Help of AI | 2024-05-20T17:32:23.500Z | [
-0.03999573737382889,
-0.0005060909898020327,
0.028289152309298515,
-0.03453768044710159,
0.043509144335985184,
0.013511709868907928,
-0.009030942805111408,
0.027238896116614342,
0.0036280725616961718,
-0.026429366320371628,
0.014726255089044571,
-0.07695293426513672,
0.04984772205352783,
... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | # Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas
In today’s data-centric world, time-series data has become indispensable for driving key organizational decisions, trend analyses, and forecasts. This kind of data is everywhere — from stock markets and IoT sensors to user behavior analyt... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.02833707258105278,
0.0024371319450438023,
0.02177046239376068,
-0.04160935431718826,
0.07728856801986694,
-0.02501668781042099,
0.011450113728642464,
0.015000634826719761,
0.019216835498809814,
0.022285381332039833,
-0.007820398546755314,
-0.06186875328421593,
0.019022731110453606,
0.02... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | MongoDB has built-in support to store time-series data in a special type of collection called a time-series collection. Time-series collections are different from the normal collections. Time-series collections use an underlying columnar storage format and store data in time-order with an automatically created clustere... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.027096791192889214,
0.023273304104804993,
0.030341608449816704,
-0.0043558645993471146,
0.06963969767093658,
-0.0035120437387377024,
-0.005248436238616705,
0.01133462693542242,
0.007697366643697023,
-0.0037319192197173834,
-0.011030576191842556,
-0.03577454388141632,
0.03645750507712364,
... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | In this tutorial, we will create a time-series collection and then store some time-series data into it. We will see how you can query it in MongoDB as well as how you can read that data into pandas DataFrame, run some analytics on it, and write the modified data back to MongoDB. This tutorial is meant to be a complete ... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.032573454082012177,
0.00856885127723217,
0.016349075362086296,
-0.019809279590845108,
0.058270130306482315,
-0.014143265783786774,
0.01614360511302948,
0.011343705467879772,
0.038788989186286926,
0.031106671318411827,
0.0025901116896420717,
-0.06290453672409058,
0.02396705374121666,
0.0... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | >Note: Before running any code or installing any Python packages, we strongly recommend setting up a separate Python environment. This helps to isolate dependencies, manage packages, and avoid conflicts that may arise from different package versions. Creating an environment is an optional but highly recommended step.
... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.04386018589138985,
-0.003356406930834055,
0.018787220120429993,
-0.031067360192537308,
-0.007703299168497324,
-0.03215634450316429,
-0.00855077151209116,
0.012959943152964115,
-0.002509333658963442,
-0.005472216755151749,
0.021563204005360603,
-0.08182912319898605,
0.02342536486685276,
... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | ```
import pymongo
import os
from pymongo import MongoClient
MONGO_CONN_STRING = os.environ.get("MONGODB_CONNECTION_STRING")
client = MongoClient(MONGO_CONN_STRING)
```
## Creating a time-series collection
Next, we are going to create a new database and a collection in our cluster to store the time-series data. We... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.03470398485660553,
0.02037637121975422,
0.020632611587643623,
-0.02892887033522129,
0.04226795956492424,
-0.013874098658561707,
0.0049956198781728745,
-0.0023642193991690874,
0.028369830921292305,
0.006251920945942402,
-0.016853084787726402,
-0.10466556996107101,
0.022274671122431755,
0... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | timeField: "timestamp",
metaField: "metadata",
granularity: "hours"
})
```
Here, we used the db.create_collection() method to create a time-series collection called “stock”. In the example above, “timeField”, “metaField”, and “granularity” are reserved fields (for more information on what these are... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.007283143233507872,
-0.0360238179564476,
0.018067574128508568,
-0.0043113501742482185,
0.053505368530750275,
-0.00604756036773324,
0.04005758464336395,
-0.019382478669285774,
0.050368763506412506,
-0.00763551564887166,
-0.002951798029243946,
-0.03941888362169266,
0.01129188109189272,
0.... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | We are storing some price metrics of this stock at an hourly interval and for each time interval, we are storing the following information:
* **open:** the opening price at which the stock traded when the market opened
* **close:** the final price at which the stock traded when the trading period ended
* **high:** the... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.0289372019469738,
-0.005756106227636337,
0.028133099898695946,
-0.006204315926879644,
0.047459352761507034,
0.020132794976234436,
0.03826991841197014,
0.02221592143177986,
0.05162712186574936,
-0.011748210527002811,
-0.00811641663312912,
-0.05436116084456444,
0.014850490726530552,
0.052... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | ```
# Create some sample data
data =
{
"metadata": {
"stockSymbol": "ABC",
"exchange": "NASDAQ"
},
"timestamp": datetime(2023, 9, 12, 15, 19, 48),
"open": 54.80,
"high": 59.20,
"low": 52.60,
"close": 53.50,
"volume": 18000
},
{
"metadata": {
"stockSymbol": "ABC",
"e... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.0354992114007473,
-0.036808136850595474,
0.031020941212773323,
-0.040119070559740067,
0.05749724432826042,
-0.008998892270028591,
0.0002972521760966629,
0.0015459489077329636,
0.0038688776548951864,
0.0030126727651804686,
-0.008437260054051876,
-0.07395680993795395,
0.004956609103828669,
... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | {
"metadata": {
"stockSymbol": "ABC",
"exchange": "NASDAQ"
},
"timestamp":datetime(2023, 9, 12, 17, 19, 48),
"open": 52.00,
"high": 53.10,
"low": 50.50,
"close": 52.90,
"volume": 10000
},
{
"metadata": {
"stockSymbol": "ABC",
"exchange": "NASDAQ"
},
"timestamp":... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.014417673461139202,
-0.03532514348626137,
0.025073129683732986,
-0.04319912940263748,
0.0485931858420372,
0.010258624330163002,
0.006096469704061747,
-0.021421127021312714,
0.022261567413806915,
0.014352455735206604,
0.015364035032689571,
-0.0773848295211792,
0.006391161121428013,
0.028... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | # insert the data into our collection
collection.insert_many(data)
```
Now, let’s run a find query on our collection to retrieve data at a specific timestamp. Run this query in the Jupyter Notebook after the previous script.
```
collection.find_one({'timestamp': datetime(2023, 9, 12, 15, 19, 48)})
```
//OUTPUT
![... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.025767987594008446,
-0.013252289965748787,
0.029701393097639084,
-0.05221915617585182,
0.0028829695656895638,
-0.00946586299687624,
0.009364370256662369,
-0.023838480934500694,
0.05999794602394104,
0.016339341178536415,
0.022351693361997604,
-0.08539100736379623,
0.02368733659386635,
0.... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | 1. MongoDB Aggregation Learning Byte
2. MongoDB Aggregation in Python Learning Byte
3. MongoDB Aggregation Documentation
4. Practical MongoDB Aggregation Book
## Analyzing the data with a pandas DataFrame
Now, let’s see how you can move your time-series data into pandas DataFrame to run some analytics operations.
... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.04088534787297249,
-0.05206771939992905,
0.0020554903894662857,
-0.017960892990231514,
0.058068353682756424,
-0.021622950211167336,
0.0023880628868937492,
0.006660361308604479,
0.0019726513419300318,
0.034535232931375504,
0.017797740176320076,
-0.1180969774723053,
0.04280159994959831,
-... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | ```
pip install pymongoarrow
```
Now, let’s import all the necessary libraries. We are going to be using the same file or notebook (Jupyter Notebook) to run the codes below.
```
import pymongoarrow
import pandas as pd
# pymongoarrow.monkey module provided an interface to patch pymongo, in place, and add pymongoarro... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.05467776581645012,
0.0006805703742429614,
0.017405429854989052,
-0.025892961770296097,
0.03629424050450325,
-0.02561277151107788,
-0.016510091722011566,
0.0070707653649151325,
-0.00209377845749259,
0.03828689083456993,
0.029631977900862694,
-0.10912544280290604,
0.040215276181697845,
-0... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | ```
print(df)
print(type(df))
```
//OUTPUT
Hurray…congratulations! As you can see, we have successfully read our MongoDB data into pandas DataFrame.
Now, if you are a stock market trader, you would be interested in doing a lot of analysis on this data to get meaningful insights. But for this tutorial, we are just ... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.035437993705272675,
-0.030191706493496895,
0.025402601808309555,
0.00815054401755333,
0.06877458840608597,
-0.014922619797289371,
0.02516753226518631,
0.02115354686975479,
0.03495802357792854,
0.0010031373240053654,
0.03473891317844391,
-0.07995058596134186,
0.023258473724126816,
0.0379... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | # print the dataframe to see the modified data
print(df)
```
//OUTPUT
![Output of modified DataFrame
As you can see, we have successfully added a new column to our DataFrame.
Now, we would like to persist the modified DataFrame data into a database so that we can run more analytics on it later. So, let’s write this... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.078060083091259,
-0.0030512537341564894,
0.03153345361351967,
-0.017141783609986305,
0.04606259986758232,
-0.010908172465860844,
-0.011986853554844856,
0.022587735205888748,
0.01934535801410675,
0.016831642016768456,
0.016215167939662933,
-0.09327299892902374,
0.037156861275434494,
0.01... |
devcenter | https://www.mongodb.com/developer/products/mongodb/time-series-data-pymongoarrow | created | print(coll.find_one({}))
```
Congratulations on successfully completing this tutorial.
## Conclusion
In this tutorial, we covered how to work with time-series data using MongoDB and Python. We learned how to store stock market data in a MongoDB time-series collection, and then how to perform simple analytics using ... | md | {
"tags": [
"MongoDB"
],
"pageDescription": "Learn how to create and query a time-series collection in MongoDB, and analyze the data using PyMongoArrow and pandas.",
"contentType": "Tutorial"
} | Analyze Time-Series Data with Python and MongoDB Using PyMongoArrow and Pandas | 2024-05-20T17:32:23.500Z | [
-0.03109734132885933,
-0.01324787549674511,
0.01443619653582573,
-0.03006911650300026,
0.0570661723613739,
-0.013501067645847797,
0.013466478325426579,
0.016434788703918457,
0.03872418403625488,
0.020277461037039757,
-0.006421270314604044,
-0.0666084811091423,
0.022881804034113884,
0.00985... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.