go-bongo / bongo Goto Github PK
View Code? Open in Web Editor NEWGo ODM for MongoDB
License: MIT License
Go ODM for MongoDB
License: MIT License
currently its not possible to use bongo because its using the deprecated mgo import paths.
For more information: http://blog.labix.org/2014/07/21/mgo-release-r2014-07-21-now-at-gopkg-in
Hello everyone,
I'm looking to do a partial update on a document (as described in the mongo docs) but it seems this ODM doesn't support it. The save() method will wholesale rewrite a document with a given object - if any fields are omitted, they will be removed.
Any reason why this was omitted? If there's not a blocking issue, I could possible contribute and add this functionality in a PR.
Regards,
William
Database connection error: %v server returned error on SASL authentication step: Authentication failed.
var err error
sess := c.Connection.Session.Clone() // if mongo cluster has a failover, sess socket may be closed, **Should Clone() replace with Copy()** ?
//otherwise I have to call sess.Refresh()
defer sess.Close()
Hi,
I have a connection string as "mongodb+srv://username:password@url"
when i try to connect to it, it gives me no reachable server whereas if i use the mongo driver, it gets connected.
The line
connection := bongo.Connect(config)
does not assign the returned error variable to anything.
Maybe change it to
connection, err := bongo.Connect(config)
if err != nil {
panic(err)
}
and let the user decide if they want to just ignore the error with _
?
Just asking. Last commit was on October. Do you have a feature roadmap or the main focus is stability, like mgo?
Best regards and congratz for your awesome work.
On running the command
err := connection.Collection("people").Save(myPerson)
I'm experiencing this error
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1284525]
goroutine 1 [running]:
main.main()
/Users/radhakotecha/Desktop/learning/golang/Mongo Connection/Backend/main.go:88 +0x3b5
exit status 2
Can you give me a simple example?
Thanks
Collection.Save(document) method invoke "CascadeSave" using goRoutine.
when i change document's field 10 times and save every times.
the function CascadeSave will invoke 10 times use 10 Routines;
the 10 Routines will not ordered, some Routines will concurrency, then parent doc error
As titled, would love to help improve.
I have tried with my local server and it didnt work, last time i used this module i have that problem
I am new to bongo. Could anybody please tell me how to remove/delete a collection?
reflect: call of reflect.Value.FieldByName on zero Value
when trying to save a value on a struct that is a pointer for example:
type BandsByRole struct {
Foo *Wrapper `bson:"foo"`
Default *Wrapper `bson:"default"
}
type Wrapper struct {
Bar BoolWrapper `bson: "bar"`
}
type BoolWrapper struct {
Baz bool `bson:"baz"`
}
saving foo.bar.baz = true will throw the error
Hi
now in bongo there is 3 operations insert , delete and find
what if i need to modify exciting element what i should do
It would be awesome if Delete would be called DeleteOne like the FindOne method.
Additionally I would love the support for complex delete queries, again, like Find.
hey guys.
Sorry for the noob question, but I couldn't understand what "cascade" actually means in this sentence:
you can cascade a player's first name and last name to his or her team.Players array on save, and remove that element in the array if you delete the player.
Supposing I have the following "team", in what could cascade help-me?
[
{
"team": "Team A",
"players": [
{
"firstname": "Player",
"lastname": "1"
},
{
"firstname": "Player",
"lastname": "2"
},
{
"firstname": "Player",
"lastname": "3"
}
]
}
]
Hello, I have not found any other ODM for MongoDB and Go.
So I am asking because I have no other choice on what to chose.
How to set a filed as unique?
How to use the foreign keys?
looking forward to using this upon a major release
cheers
Hello guys
I want to make an endpoint in my application to check if a slug already exists
I made in this way:
connection := storage.DbBongo()
connection.Collection("mycollection").FindOne(bson.M{"slug": slug}, &post)
isAvailable := post.Id == ""
/// RESPONSE IF IS AVAILABLE AFTER
But, in this query to MongoDb I'm getting all post data
I want to make a simple query getting only if exist or not
To simplify, I want to count
Like this:
isAvailable := connection.Collection("communities").Find(bson.M{"slug": slug}).Count() == 0
How can I do this?
Thanks
How would I go about creating indexes with Bongo? I have several collections that will require unique indexes, and would love to use Bongo for modeling. (I assume once I have the constraints set up, I'll be able to parse any validation errors, including unique constraint errors, during the middleware hooks – correct?)
gopkg.in/mgo.v2
now UNMAINTAINED, import path should use the fork github.com/globalsign/mgo
In README document:
err := connection.Collection("people").FindOne(bson.M{"firstName":"Bob"})
Should be:
err := connection.Collection("people").FindOne(bson.M{"firstName":"Bob"}, person)
Hi guys thanks for this project, it is amazing.
My Question is I can populate a child collection when the parent document has only ObjectId for relation.
Somthing like this:
type User struct {
...
Address bson.ObjectId `bson:"address"`
}
connection.Collection("user").Find(bson.M{"firstName":"Bob"}).Populate("messages")
Best regards.
When I try to import the library, I get error about missing dependency which is not present on GitHub:
go get github.com/maxwellhealth/bongo
cd .; git clone https://github.com/maxwellhealth/go-dotaccess /Users/user/go/src/github.com/maxwellhealth/go-dotaccess
Cloning into '/Users/user/go/src/github.com/maxwellhealth/go-dotaccess'...
remote: Repository not found.
fatal: repository 'https://github.com/maxwellhealth/go-dotaccess/' not found
package github.com/maxwellhealth/go-dotaccess: exit status 128
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.