MongoFixtures library for Dart

Build Status Pub

A library for inserting your test fixtures into the MongoDb using mongo_dart.


A simple usage example:

import 'package:mongo_fixtures/mongo_fixtures.dart' as fixtures;

List<fixtures.Entity> fixturesProvider(fixtures.Loader loader) {
    return [

        new fixtures.Collection('some_collection')
            ..insert(map: {
                'field_one': 'value1',
                'field_two': 'value2',
                'field_three': loader.document('document').field('another_field_one'),

        new fixtures.Collection('some_another_collection')
            ..insert(map: {
                'another_field_one': 'value3',
                'another_field_two': 'value4',
                'another_field_three': loader.document('document').id(),
                'another_field_four': loader.document('document').idAsHexString()
            ..insert(label: 'document', map: {
                'another_field_one': 'value3',
                'another_field_two': 'value4',


main() {

    group('test group', () {

        setUp(() {
            return new fixtures.Loader('mongodb://')



Features and bugs

Please file feature requests and bugs at the issue tracker.