Insertion of data in buckets

Hi,
i just go through the $bucket clause in mongodb and test that as well. I came to know that it was at output level while getting the records from the database. is there is any way to insert data into respective records as we do in hive(bucketing) ? if so then kindly share the syntax
thanks

Here is the link: https://docs.mongodb.com/manual/reference/operator/aggregation/bucket/
i just want to know that is there is any possibility to insert the data in buckets as in the above link we can only retrieve the data from the collections in buckets.

Thanks

what i concluded is that we can’t insert data in mongoDB in buckets(like we used to do in hive etc) but we can retrieve the documents in form of buckets. Check this link for bucket pattern

Do you mean like this: https://www.mongodb.com/blog/post/building-with-patterns-the-bucket-pattern

yes @Asya_Kamsky. that is only used when we want to display the document then we can use bucketing but it is not the same as we have in HIVE etc

Maybe it would be easier to answer if you describe exactly what functionality you are looking for… Do you mean partitioning collections (similar to RDBMS partitioning)?

yes, I want to store the data(documents) in bucketed(partitioning in RDBMS) form so that when so ever I apply some find operation it should not scan the whole data.

That’s not how things work in MongoDB - unless you are doing an unindexed query. If you create an index on field (or fields) that you are querying by, then the index will be quickly searched and only documents matching the values you’re querying about will be fetched. This is just like regular indexes in RDMBS.

Asya

Oh! It mean that we can’t do the same thing as we do in Hive(bucketing) so mongodb ONLY support for displaying the data in bucketed form(run time)

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.