iefpw
iefpw

Reputation: 7052

Saving data in MongoDB

How do I save a data to MongoDB? I have a about 1GB size object turned to BsonDocument. I want to save this file to MongoDB. Since the mongo supports only 4MB, how I would I save this gigantic bsondocument? If I use gridFS, would the gridfs automatically chunk this large object by itself and send it to the server?

Please any help and pointers are appreciated.

Is there any tricks and stuff that I should know about. I'm not saving any images, videos or audios. I'm saving a object graph (2GB) Do I have to turn the object graph to bsondocument and then send it to the server?

Upvotes: 1

Views: 762

Answers (1)

Gates VP
Gates VP

Reputation: 45297

Using GridFS will basically make this object into a series of "file chunks" and it will behave like a file.

I have a about 1GB size object turned to BsonDocument.

You need to break this out into multiple BsonDocuments against which you can query. MongoDB is completely incapable of handling a single giant BsonDocument.

MongoDB is intended to store lots of little BsonDocuments and allow you query against them.

I'm saving a object graph (2GB)

Is it possible to break this out into queryable pieces?

If not, then you may be using the wrong DB. There are a few Graph Database designed for this type of storage and querying. Check out Neo4J or Microsoft's Trinity.

These are Graph DBs designed for handling this type of work.

Upvotes: 1

Related Questions