This project demonstrates how to access MongoDB database locally using the mongo_dart package.
For installing MongoDB visit https://docs.mongodb.com/manual/administration/install-community/ and select your OS for instructions.
(You can manually insert documents by creating a collection and then using the insert or insertMany function on your collection)
db.collection.insert(<document or array of documents>)
OR
db.collection.insertMany([ <document 1> , <document 2>, ... ],)
-
Start your MongoDB server
mongod
-
Import person.json with
mongoimportexecutablemongoimport --jsonArray -d <yourDatabaseName> -c <yourCollectionName> --file <path/To/File.json>
Execute this command in your terminal:
dart main.dartYou can use the GET, POST, PUT, DELETE methods while making the request to the localhost
and perform the basic CRUD operations on your database locally. (using the /people endpoint)