GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - rs/rest-layer-mongo: REST Layer MongoDB resource storage handler

BranchesTags
Open more actions menu

Latest commit

 

History

50 Commits
50 Commits

Folders and files

NameName
Last commit message
Last commit date
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
example_test.go
example_test.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
id.go
id.go
 
 
id_test.go
id_test.go
 
 
mongo.go
mongo.go
 
 
mongo_test.go
mongo_test.go
 
 
query.go
query.go
 
 
query_test.go
query_test.go
 
 

Repository files navigation

REST Layer MongoDB Backend

godoc license build

This REST Layer resource storage backend stores data in a MongoDB cluster using mgo.

Usage

import "github.com/rs/rest-layer-mongo"

Create a mgo master session:

session, err := mgo.Dial(url)

Create a resource storage handler with a given DB/collection:

s := mongo.NewHandler(session, "the_db", "the_collection")

Use this handler with a resource:

index.Bind("foo", foo, s, resource.DefaultConf)

You may want to create a many mongo handlers as you have resources as long as you want each resources in a different collection. You can share the same mgo session across all you handlers.

Object ID

This package also provides a REST Layer schema.Validator for MongoDB ObjectIDs. This validator ensures proper binary serialization of the Object ID in the database for space efficiency.

You may reference this validator using mongo.ObjectID as schema.Field.

A mongo.NewObjectID field hook and mongo.ObjectIDField helper are also provided.

About

REST Layer MongoDB resource storage handler

Resources

Readme
MIT license
Activity

Stars

18 stars

Watchers

5 watching

Forks

11 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.