Skip to content

How to initialize data/collections/indexes on startup? #875

@thardy

Description

@thardy

I want to initialize my mongodb-memory-server with the some collections, indexes, and initial data for testing. I'd like to use the same file full of shell commands I use with my Docker deployment if possible. Many of my tests involve unique indexes and testing for proper responses to duplicate inserts, etc.

I saw the answers to this question - #309, but they did not mention how to programmatically execute mongo commands from a file against the newly created MongoMemoryServer.

Any help will be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions