@@ -338,77 +338,87 @@ corresponds to your Atlas cluster.
338
338
Run a Sample Query
339
339
------------------
340
340
341
- .. step:: Create a Project Directory
341
+ You can create an application that connects to your MongoDB
342
+ deployment and retrieves data from the ``movies`` collection
343
+ in the ``sample_mflix`` database.
342
344
343
- In your shell, navigate to where you want to create your
344
- application, then run the following command to create a
345
- directory called ``c-quickstart`` for this project:
345
+ To learn more about the ``sample_mflix`` database, see :atlas:`Sample Mflix Dataset
346
+ </sample-data/sample-mflix/>` in the Atlas documentation.
346
347
347
- .. code-block:: bash
348
+ .. procedure::
349
+ :style: connected
348
350
349
- mkdir c-quickstart
351
+ .. step:: Create a Project Directory
350
352
351
- Select the tab corresponding to your operating system and run the
352
- following commands to create a ``quickstart.c`` application file
353
- in the ``c-quickstart`` directory:
353
+ In your shell, navigate to where you want to create your
354
+ application, then run the following command to create a
355
+ directory called ``c-quickstart`` for this project:
356
+
357
+ .. code-block:: bash
354
358
355
- .. tabs::
359
+ mkdir c-quickstart
356
360
357
- .. tab:: macOS / Linux
358
- :tabid: create-file-mac-linux
361
+ Select the tab corresponding to your operating system and run the
362
+ following commands to create a ``quickstart.c`` application file
363
+ in the ``c-quickstart`` directory:
359
364
360
- .. code-block:: bash
365
+ .. tabs::
361
366
362
- cd c-quickstart
363
- touch quickstart.c
367
+ .. tab:: macOS / Linux
368
+ :tabid: create-file-mac-linux
364
369
365
- .. tab:: Windows
366
- :tabid: create-file-windows
370
+ .. code-block:: bash
367
371
368
- .. code-block:: bash
372
+ cd c-quickstart
373
+ touch quickstart.c
369
374
370
- cd c-quickstart
371
- type nul > quickstart.c
375
+ .. tab:: Windows
376
+ :tabid: create-file-windows
372
377
373
- .. step:: Create Your C Driver Application
378
+ .. code-block:: bash
374
379
375
- Copy and paste the following code into the ``quickstart.c`` file, which queries
376
- the ``movies`` collection in the ``sample_mflix`` database:
380
+ cd c-quickstart
381
+ type nul > quickstart.c
377
382
378
- .. literalinclude:: /includes/get-started/quickstart.c
379
- :language: c
383
+ .. step:: Create Your C Driver Application
380
384
381
- .. step:: Assign the Connection String
385
+ Copy and paste the following code into the ``quickstart.c`` file, which queries
386
+ the ``movies`` collection in the ``sample_mflix`` database:
382
387
383
- Replace the ``<connection string>`` placeholder with the
384
- connection string that you copied from the :ref:`c-get-started-connection-string`
385
- step of this guide.
388
+ .. literalinclude:: /includes/get-started/quickstart.c
389
+ :language: c
386
390
387
- .. step:: Run Your C Application
391
+ .. step:: Assign the Connection String
388
392
389
- In your shell, run the following commands to compile and run this application:
390
-
391
- .. code-block:: none
393
+ Replace the ``<connection string>`` placeholder with the
394
+ connection string that you copied from the :ref:`c-get-started-connection-string`
395
+ step of this guide.
396
+
397
+ .. step:: Run Your C Application
398
+
399
+ In your shell, run the following commands to compile and run this application:
400
+
401
+ .. code-block:: none
392
402
393
- gcc -o quickstartc quickstart.c $(pkg-config --libs --cflags libmongoc-1.0)
394
- ./quickstartc
403
+ gcc -o quickstartc quickstart.c $(pkg-config --libs --cflags libmongoc-1.0)
404
+ ./quickstartc
395
405
396
- The command line output contains details about the retrieved movie
397
- document:
406
+ The command line output contains details about the retrieved movie
407
+ document:
398
408
399
- .. code-block:: none
400
- :copyable: false
409
+ .. code-block:: none
410
+ :copyable: false
401
411
402
- { "_id" : { "$oid" : "..." },
403
- "plot" : "Two imprisoned men bond over a number of years, finding solace
404
- and eventual redemption through acts of common decency.",
405
- ...
406
- "title" : "The Shawshank Redemption",
407
- ...
412
+ { "_id" : { "$oid" : "..." },
413
+ "plot" : "Two imprisoned men bond over a number of years, finding solace
414
+ and eventual redemption through acts of common decency.",
415
+ ...
416
+ "title" : "The Shawshank Redemption",
417
+ ...
408
418
409
- If you encounter an error or see no output, ensure that you specified the
410
- proper connection string in the ``quickstart.c`` file and that you loaded the
411
- sample data.
419
+ If you encounter an error or see no output, ensure that you specified the
420
+ proper connection string in the ``quickstart.c`` file and that you loaded the
421
+ sample data.
412
422
413
423
After you complete these steps, you have a working application that
414
424
uses the driver to connect to your MongoDB deployment, runs a query on
0 commit comments