Skip to content
New issue

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

Documentation Issue: Unable to use c.NewDocument() in v2 branch #159

Open
MohammadMMoniri opened this issue Oct 13, 2024 · 1 comment · May be fixed by #160
Open

Documentation Issue: Unable to use c.NewDocument() in v2 branch #159

MohammadMMoniri opened this issue Oct 13, 2024 · 1 comment · May be fixed by #160

Comments

@MohammadMMoniri
Copy link

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.

@MohammadMMoniri
Copy link
Author

I found the same problem for query documentations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant