user3423215
user3423215

Reputation:

How to divide 1 mongoDB collection into 2 or more collections

I'm using mongoDB to scrap a dataset using Node.js. The collection which I have has 0.2 million documents and so the Node.js is crashing giving a segmentation fault. Is there a way to split/divide the collection to 2 or more collections so that Node.js doesn't crash. Thanks!!

Upvotes: 1

Views: 419

Answers (1)

Swetha
Swetha

Reputation: 467

Did you try using limit to constraint the no of documents returned? You can take the total document count in collection and then split it using limit and skip For ex: if collection has 200 docs First time limit 100 docs and skip 0 Second time limit 100 again but this time skip 100 This is oneway i an think of. There may be other ways

Upvotes: 1

Related Questions