Documentation ¶
Overview ¶
Package mongodb implements a cleint interface to a mongodb server that supports MongoDB's query and update API.
Index ¶
- type MongoCollection
- func (mc *MongoCollection) DeleteMany(ctx context.Context, filter bson.D) error
- func (mc *MongoCollection) DeleteOne(ctx context.Context, filter bson.D) error
- func (mc *MongoCollection) FindMany(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)
- func (mc *MongoCollection) FindOne(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)
- func (mc *MongoCollection) InsertMany(ctx context.Context, documents []interface{}) error
- func (mc *MongoCollection) InsertOne(ctx context.Context, document interface{}) error
- func (mc *MongoCollection) ReplaceMany(ctx context.Context, filter bson.D, replacements ...interface{}) (int, error)
- func (mc *MongoCollection) ReplaceOne(ctx context.Context, filter bson.D, replacement interface{}) (int, error)
- func (mc *MongoCollection) UpdateMany(ctx context.Context, filter bson.D, update bson.D) (int, error)
- func (mc *MongoCollection) UpdateOne(ctx context.Context, filter bson.D, update bson.D) (int, error)
- func (mc *MongoCollection) Upsert(ctx context.Context, filter bson.D, document interface{}) (bool, error)
- func (mc *MongoCollection) UpsertID(ctx context.Context, id primitive.ObjectID, document interface{}) (bool, error)
- type MongoCursor
- type MongoDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoCollection ¶
type MongoCollection struct {
// contains filtered or unexported fields
}
Implements the backend.NoSQLCollection interface as a client-wrapper to a mongodb server
func (*MongoCollection) DeleteMany ¶
Implements the backend.NoSQLCollection interface
func (*MongoCollection) DeleteOne ¶
Implements the backend.NoSQLCollection interface
func (*MongoCollection) FindMany ¶
func (mc *MongoCollection) FindMany(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) FindOne ¶
func (mc *MongoCollection) FindOne(ctx context.Context, filter bson.D, projection ...bson.D) (backend.NoSQLCursor, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) InsertMany ¶
func (mc *MongoCollection) InsertMany(ctx context.Context, documents []interface{}) error
Implements the backend.NoSQLCollection interface
func (*MongoCollection) InsertOne ¶
func (mc *MongoCollection) InsertOne(ctx context.Context, document interface{}) error
Implements the backend.NoSQLCollection interface
func (*MongoCollection) ReplaceMany ¶
func (mc *MongoCollection) ReplaceMany(ctx context.Context, filter bson.D, replacements ...interface{}) (int, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) ReplaceOne ¶
func (mc *MongoCollection) ReplaceOne(ctx context.Context, filter bson.D, replacement interface{}) (int, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) UpdateMany ¶
func (mc *MongoCollection) UpdateMany(ctx context.Context, filter bson.D, update bson.D) (int, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) UpdateOne ¶
func (mc *MongoCollection) UpdateOne(ctx context.Context, filter bson.D, update bson.D) (int, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) Upsert ¶
func (mc *MongoCollection) Upsert(ctx context.Context, filter bson.D, document interface{}) (bool, error)
Implements the backend.NoSQLCollection interface
func (*MongoCollection) UpsertID ¶
func (mc *MongoCollection) UpsertID(ctx context.Context, id primitive.ObjectID, document interface{}) (bool, error)
Implements the backend.NoSQLCollection interface
type MongoCursor ¶
type MongoCursor struct {
// contains filtered or unexported fields
}
Implements the backend.NoSQLCursor interface as a client-wrapper to the Cursor returned by a mongodb server
func (*MongoCursor) All ¶
func (mr *MongoCursor) All(ctx context.Context, objs interface{}) error
Implements the backend.NoSQLCursor interface
func (*MongoCursor) One ¶
func (mr *MongoCursor) One(ctx context.Context, obj interface{}) (bool, error)
Implements the backend.NoSQLCursor interface
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
Implements the backend.NoSQLDatabase interface as a client-wrapper to a mongodb server.
func NewMongoDB ¶
Instantiates a new MongoDB client-wrapper instance which connects to a mongodb server running at `addr`. REQUIRED: A mongodb server should be running at `addr`
func (*MongoDB) GetCollection ¶
func (md *MongoDB) GetCollection(ctx context.Context, db_name string, collectionName string) (backend.NoSQLCollection, error)
Implements the backend.NoSQLDatabase interface