Golang library for MongoDB (DBAL)

Here is my DBAL implementation for mongoDB that I am using in my daily routines.

It contains features that I am using frequently it does not contain any implementation for DSL or Query Builders.

All extra features will be added later or maybe I will put it into a different library.

https://github.com/wajox/mongol

Golang Hints: Create MongoDB Object ID from String

Sometimes you may want to find something by the Object ID in your MongoDB and due to you URI or query string contains ID you should convert the string ID to Object ID.

Below is a code that converts string ID to Object ID:

 package main

import (
"go.mongodb.org/mongo-driver/bson/primitive"
"fmt"
)
func main() {
oid, err := primitive.ObjectIDFromHex(recordID)

fmt.Printf("%s %v", err, oid)

  // if err := collection.FindOne(ctx, bson.M{"_id": oid}).Decode(e); err != nil {
  // return nil, err
// }
}