-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d90b455
commit 70eab31
Showing
5 changed files
with
30 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ func main() { | |
} | ||
|
||
func db() *mongo.Client { | ||
clientOptions := options.Client().ApplyURI("mongodb+srv://Demo03:[email protected]/citizen?retryWrites=true&w=majority ") | ||
clientOptions := options.Client().ApplyURI("mongodb+srv://Demo03:[email protected]/?retryWrites=true&w=majority&appName=Demo") | ||
// Connect to MongoDB | ||
client, err := mongo.Connect(context.TODO(), clientOptions) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
package model | ||
|
||
import "go.mongodb.org/mongo-driver/bson/primitive" | ||
|
||
type Citizen struct { | ||
ID string `json:"id"` | ||
FirstName string `json:"firstName"` | ||
LastName string `json:"lastName"` | ||
DOB string `json:"dob"` | ||
Gender string `json:"gender"` | ||
Address string `json:"address"` | ||
City string `json:"city"` | ||
State string `json:"state"` | ||
Pincode string `json:"pincode"` | ||
ID primitive.ObjectID `json:"id" bson:"_id"` | ||
FirstName string `json:"firstName"` | ||
LastName string `json:"lastName"` | ||
DOB string `json:"dob"` | ||
Gender string `json:"gender"` | ||
Address string `json:"address"` | ||
City string `json:"city"` | ||
State string `json:"state"` | ||
Pincode string `json:"pincode"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters