🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

github.com/pm-redemption/mongodb

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/pm-redemption/mongodb

v1.1.1
Version published
Created
package main

import (
	"fmt"

	"github.com/pm-redemption/mongodb"
	"go.mongodb.org/mongo-driver/bson"
)

func main() {
	mongo := &mongodb.Opt{
		Url:             "mongodb://127.0.0.1:37017",
		Database:        "admin_request_log",
		MaxConnIdleTime: 5,
		MaxPoolSize:     1000,
		Username:        "",
		Password:        "",
	}

	client := mongo.NewClient()

	res := client.Collection("request_log").InsertOne(bson.M{"name": "pi", "value": 3.14159})

	fmt.Println(res)

	var result struct {
		Value float64
	}

	err := client.Collection("request_log").Where(bson.M{"name": "pi"}).FindOne(&result)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(result)

}

FAQs

Package last updated on 24 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts