simple

command module
v0.0.0-...-838b099 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 8 Imported by: 0

README

Connecting to MongoDB

An example of how you would connect to MongoDB and perform basic CRUD operations.

There's another example that performs the same operation but with a pre-defined schema.

Setup

Here's a sequence of steps to run this project.

  1. Launch a shell session and start MongoDB (server) via Docker:

    $ docker-compose up
    
  2. You can connect to Mongo via the console:

    $ docker exec -it mongo mongo -u nobody -p secrets go-recipes
    
  3. Run Go program.

    $ go run ./main.go
    
  4. When you are done, just shut mongo down.

    $ docker-compose down
    $ docker-compose down
    
  5. Alternatively, you can run everything with just 2 commands.

    $ make run
    $ make teardown    # Run this to remove container
    

Reference and Credits

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL