Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crufter/resolver

Automatic resolution of MongoDb foreign keys without DBRefs.
https://github.com/crufter/resolver

Last synced: 22 days ago
JSON representation

Automatic resolution of MongoDb foreign keys without DBRefs.

Awesome Lists containing this project

README

        

resolver
========

Mongodb database references without DBRefs, and automatic resolution of them.

What does it do?
========
You pass in a *mgo.Database (db) and a query result (v) to
```
resolver.Resolve(db, v, nil)
```

And this package will resolve all "foreign key references" which value is an instance of bson.ObjectId, and which key has the form of:
```
"_collName"
// or
"_collName_customFieldName" // In case of there are more than one reference to a given collection in a document.
```

The value can be a single bson.ObjectId or a []bson.ObjectId.