How to save an array of objects to mongoose DB with only one call?

后端 未结 5 1700
野的像风
野的像风 2020-12-29 07:34

Is there any way to save an array of JSON object to a mongodb with only one call? something like:

schemeObject.save(array_of_json_object, ca         


        
5条回答
  •  执笔经年
    2020-12-29 07:43

    I do not think its possible with mongooosejs. You can however use BATCH insert of mongodb ,which is supported natively.

    Helpful links:

    http://www.mongodb.org/display/DOCS/Inserting#Inserting-Bulkinserts

    https://groups.google.com/forum/#!msg/mongoose-orm/IkPmvcd0kds/bZuYCN_orckJ

提交回复
热议问题