Skip to content

JohnAD/jestermongopool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to jestermongopool

ver 1.0.1

nimble repo.support

This is a plugin for the nim web framework Jester. It supports the MongoPool library's use with Jester.

GETTING A MONGODB CONNECTION

Include the plugin nextMongoConnection("<failureUrl>") at the top of your main routes or primary router. This will enable the plugin for the whole web site. The variable connected will be the resulting "next" connection.

If the driver is unable to pull a good connection from the pool of connections, then web request will be redirected to the failureUrl provided (and the page route will not run.)

For example:

import jester
import jestermongopool
import mongopool
import bson

connectMongoPool("mongodb://someone:secret@mongo.domain.com:27017/abc")

routes:
  plugin db <- nextMongoConnection("/dberror")
  get "/":
    var doc = db.find("webday").returnOne()
    resp "doc = " & $doc
  get "/dberror":
    resp "database error.<br /><pre>" & getMongoPoolStatus() & "</pre>"

Table Of Contents

  1. Introduction to jestermongopool

  2. Appendices

    1. jestermongopool Reference

About

Plugin(s) for Jester that supports the MongoPool MongoDb driver.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages