-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Labels
🚀 enhancementNew feature or requestNew feature or requestarea/coreRefers to Mongo Seeding libraryRefers to Mongo Seeding libraryhelp wanted
Description
I just ran into this issue where all the added data would show up under a single document (with a single ID) in MongoDB. After about 30 minutes of tinkering around, trying stuff, and digging through the source code—I noticed how I exported my data using export default instead of export = [].
Why would export default result in this module thinking that I want to add an array as single document? export = [] doesn't really seem like a pattern many libs use/require?
‼️ Wrong way
export default [
{ name: "My First Item" },
{ name: "My Second Item" },
{ name: "My Third Item" },
{ name: "My Last Item" }
];✅ Right way
export = [
{ name: "My First Item" },
{ name: "My Second Item" },
{ name: "My Third Item" },
{ name: "My Last Item" }
];Suggestion
Maybe it's safe to assume that when the user exports an array, they want it to be imported as separate documents in their database?
Overal very useful tool, saves me a bunch of boilerplate code. 😄
dvdvdmt, sramzan, gustavares, Kujbor, alembikovm and 3 moreKujbor
Metadata
Metadata
Assignees
Labels
🚀 enhancementNew feature or requestNew feature or requestarea/coreRefers to Mongo Seeding libraryRefers to Mongo Seeding libraryhelp wanted