Skip to content
This repository was archived by the owner on Dec 1, 2020. It is now read-only.

Battlefy/Arboria

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arboria

A fixture loader for mongo (that doesn't db.open)

Example

var arboria = require('arboria');

var mongodb = require('mongodb');
var Server = mongodb.Server;
var MongoClient = mongodb.MongoClient;

var server = new Server('localhost', '27017', { native_parser: true });
var connection = new MongoClient(server);

connection.open(function(err, mongoClient) {
  
  var a = arboria(mongoClient.db('test-db'));
  var fixture = a.fixture('test-collection');

});

Add Some Data

  
fixture
  .add({ name: "Shane", age: 25 })
  .add({ name: "Robert", age: 23 })
  .done(function(err, data) {
    console.log('added Shane and Robert');
  });

Remove Some Data

fixture
  .remove({ name: "Robert", age: 23 })
  .done(function(err, data) {
    console.log('removed Robert.');
  });

Do Both at the Same Time

fixture
  .add('justin')
  .remove({ name: "Shane", age: 25 })
  .done(function(err, data) {
    console.log('added Justin from \'/test/fixtures/justin.json\' and removed Shane.');
  });

About

Fixture loader for MongoDB

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors