We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am new to bongo. Could anybody please tell me how to remove/delete a collection?
The text was updated successfully, but these errors were encountered:
There are two ways to delete.
If there is a document you want to remove Use DeleteDocument().
or you can use Delete() if you want to remove it with a query.
I can give an example for DeleteDocument as follows.
type User struct { bongo.DocumentBase `bson:",inline"` UserName string `json:"username"` } // get user user := &User{} _ = connection.Collection("people").FindOne(bson.M{ "username": "test", }, user) // DeleteDocument err = connection.Collection("people").DeleteDocument(user) log.Println(err)
If you want to remove it with a query, use Delete.
changeInfo, err := connection.Collection("people").Delete(bson.M{ "username": "test", }) log.Println(changeInfo, err)
Sorry, something went wrong.
No branches or pull requests
I am new to bongo. Could anybody please tell me how to remove/delete a collection?
The text was updated successfully, but these errors were encountered: