All Projects → CImrie → Mongomem

CImrie / Mongomem

In-memory MongoDB Server. Ideal for testing.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mongomem

Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (+4041.18%)
Mutual labels:  mongoose, mongodb, ava
Node Express Mongodb Jwt Rest Api Skeleton
This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API). Demo of frontend in VueJS here: https://github.com/davellanedam/vue-skeleton-mvp
Stars: ✭ 603 (+1082.35%)
Mutual labels:  mongoose, mongodb
Node Express Mongoose Demo
A simple demo app using node and mongodb for beginners
Stars: ✭ 4,976 (+9656.86%)
Mutual labels:  mongoose, mongodb
Node Express Boilerplate
A boilerplate for building production-ready RESTful APIs using Node.js, Express, and Mongoose
Stars: ✭ 890 (+1645.1%)
Mutual labels:  mongoose, mongodb
Api Design Node V3
[Course] API design in Node with Express v3
Stars: ✭ 459 (+800%)
Mutual labels:  mongoose, mongodb
Fawn
Transactions for MongoDB (See the README)
Stars: ✭ 474 (+829.41%)
Mutual labels:  mongoose, mongodb
Nodepress
😎 RESTful API service for Blog/CMS, powered by @nestjs
Stars: ✭ 829 (+1525.49%)
Mutual labels:  mongoose, mongodb
Private Project
一些基于React、Vue、Node.js、MongoDB技术栈的实践项目
Stars: ✭ 438 (+758.82%)
Mutual labels:  mongoose, mongodb
Node Auth
基于 Node Express Mongoose 实现的用户注册/登陆权限验证
Stars: ✭ 10 (-80.39%)
Mutual labels:  mongoose, mongodb
Summary
个人总结 持续更新 欢迎提出各种issues
Stars: ✭ 12 (-76.47%)
Mutual labels:  mongoose, mongodb
Jwt Node Vue
Repositório responsável pelo primeiro projeto da série de vídeos: Coding Stuff.
Stars: ✭ 29 (-43.14%)
Mutual labels:  mongoose, mongodb
Graphql Advanced Projection
Fully customizable Mongoose/MongoDB projection generator.
Stars: ✭ 46 (-9.8%)
Mutual labels:  mongoose, mongodb
Youtube Clone Nodejs Api
VueTube is a YouTube clone built with nodejs, expressjs & mongodb. This is the RESTful API repository.
Stars: ✭ 441 (+764.71%)
Mutual labels:  mongoose, mongodb
Egg Restfulapi
🏅 基于Egg.js 2.0 & {mongoose,jwt}RESTful API 模板,用于快速集成开发RESTful前后端分离的服务端。
Stars: ✭ 524 (+927.45%)
Mutual labels:  mongoose, mongodb
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (+758.82%)
Mutual labels:  mongoose, mongodb
Mevn Cli
Light speed setup for MEVN(Mongo Express Vue Node) Apps
Stars: ✭ 696 (+1264.71%)
Mutual labels:  mongoose, mongodb
Cmms
Computerized Maintenance Management System
Stars: ✭ 31 (-39.22%)
Mutual labels:  mongoose, mongodb
Egg Mongoose
Stars: ✭ 386 (+656.86%)
Mutual labels:  mongoose, mongodb
Spruce
A social networking platform made using Node.js and MongoDB
Stars: ✭ 399 (+682.35%)
Mutual labels:  mongoose, mongodb
Express Boilerplate
🚀 Starter project for a RESTful API in Node with Express & mongoose component-based
Stars: ✭ 9 (-82.35%)
Mutual labels:  mongoose, mongodb

MongoMem

This package provides an in-memory MongoDB Server. Designed with testing in mind, the server will allow you to connect your favourite ODM or client library to the MongoDB Server and run integration tests isolated from each other.

How it works This project is not an alternative in-memory MongoDB implementation. This runs using mongodb-prebuilt, which uses a MongoDB binary from NPM and runs it with the ephemeralForTest storage engine.

Note about AVA Test Runner The package was designed to run one server instance (max) at a time. As such it runs one server instance per test file in AVA (as a result of AVA using forked processes). This has no negative consequences but it does mean that you should call MongoDBServer.start() only once, at the top of an imported file or test file. Calling it in a helper method may result in either unexpected behaviour or multiple servers running per test file.

Usage

The example below uses async/await from ES7. If you wish to use the same syntax, you should transpile your code using babel-preset-es2017. Alternatively, if you are already using ES6 then you can convert it to the appropriate Promise syntax.

Available on NPM using: npm install mongomem --save-dev or yarn add mongomem --dev

See here for usage examples: https://coligo.io/javascript-async-await/

// helpers.js
import mongoose from 'mongoose'
import { MongoDBServer } from 'mongomem'

// MongoDBServer.debug = true;
let serverHasStarted = MongoDBServer.start();

export default {
  async getMongooseMock() {
      // 
      const mongooseInstance = new mongoose.Mongoose();
      await serverHasStarted;
    
      // MongoDBServer.getConnectionString() returns a new UUID4 on every call.
      // This allows you to get a unique database whilst utilising one in-memory server.
      let db = await MongoDBServer.getConnectionString();
      await mongooseInstance.connect(db, {promiseLibrary: Promise});
      
      // Re-assign original mongose models to new Mongoose connection
      Object.keys(mongoose.models).forEach(name => {
        const model = mongoose.models[name];
        mongooseInstance.model(name, model.schema);
      });
    
      return mongooseInstance;
  }
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].