golistic / pxmysql

Go MySQL driver using X Protocol
MIT License
14 stars 0 forks source link

Remove documents from a collection #70

Open geertjanvdk opened 1 year ago

geertjanvdk commented 1 year ago

User Story

As a developer working with a collection, I want to have a Remove method available in the collection, So that I can easily delete documents from the collection when necessary.

Acceptance Criteria

Technical notes

Example

type Person struct {
  Name string `json:"name"`
  Age  int `json:"age"`
}

myColl, _ := db.GetCollection("my_collection")

myColl.Remove("name like :name AND age < :age").
  Limit(1).Bind("name","N%").
  Bind("age", 60).
  Execute(context.Background());

Value

By adding the Remove method to the collection, we provide developers with a convenient and efficient way to delete documents from the collection.