-
-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
Issue with Using c.NewDocument()
in v2 Branch Documentation
I'm experiencing issues using the NewDocument
function from the "github.com/ostafen/clover/v2" package as described in the documentation.
Original Code
According to the documentation, I should be able to use:
db, _ := c.Open("clover-db")
db.CreateCollection("myCollection") // create a new collection named "myCollection"
// insert a new document inside the collection
doc := c.NewDocument()
doc.Set("hello", "clover!")
However, this code does not work.
Workaround
To make it work, I had to import the document
package separately and use its NewDocument()
function:
import (
c "github.com/ostafen/clover/v2"
cloverDocument "github.com/ostafen/clover/v2/document"
)
db, _ := c.Open("clover-db")
db.CreateCollection("myCollection") // create a new collection named "myCollection"
// insert a new document inside the collection
doc := cloverDocument.NewDocument()
doc.Set("hello", "clover!")
I'll be submitting a PR to address this issue, but I wanted to raise it first so we can discuss and resolve it together.
Metadata
Metadata
Assignees
Labels
No labels