vadimdemedes / mongorito

🍹 MongoDB ODM for Node.js apps based on Redux
1.38k stars 90 forks source link

Bulk insert #194

Open vinaybedre opened 7 years ago

vinaybedre commented 7 years ago

Hi,

Using mongorito, is it possible to save multiple instances of an object to MongoDB?

DavidBernal commented 7 years ago

Quick and dirty:

import User from 'User';

var a = new User();
var b = new User();
var c = [a, b];

c.forEach(u => u.save())

Is it good for you?

vinaybedre commented 7 years ago

hi @DavidBernal Thanks for the hint, but this is very obvious and expected :-)

What if I have thousands of documents to be inserted? Kind of bulk data insert. (at least 1000+ documents to be inserted at a time). Is there a way?

vadimdemedes commented 7 years ago

Currently, there's no API to bulk insert. I'll keep that as a feature request, thanks!