dce-mango
Version:
Harvard DCE's Non-relational DB Wrapper.
37 lines (36 loc) • 1.38 kB
TypeScript
/**
* Get a copy of the db collection class with
* Mongo/Amazon DocDB wrapper with functions that are
* equally compatible with both
* @author Gabe Abrams
* @param [opts] object containing all arguments
* @param [opts.schemaVersion=1] the version of the schema. Whenever you
* change your schema, increment this number and dce-mango will automatically
* re-build and re-provision your collections
* @param [dbName=env.DB_NAME ?? 'mango-store'] the name of the database
* to set up/use
* @param [dbInfo=env vars] either include an object
* with a mongo-style url: { url } or include an object
* with pieces of a mongo-style url:
* { user, pass, host, [options] } where options
* is optional.
* Otherwise, dce-mango will use environment variables instead:
* either env.DB_URL or env.DB_USER + DB_PASS + DB_HOST must
* be included, optionally with an included DB_OPTIONS. You can also use
* mongo env vars: env.MONGO_URL or env.MONGO_USER + MONGO_PASS + MONGO_HOST
* and optionally MONGO_OPTIONS
* @returns collection class that references the given database
*/
declare const initMango: (opts: {
schemaVersion: number;
dbName?: string;
dbInfo?: ({
url: string;
} | {
user: string;
pass: string;
host: string;
options?: string;
});
}) => void;
export default initMango;