Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auditing BulkWrite in MogoDB #185

Open
renegadeHomie opened this issue Feb 15, 2017 · 3 comments
Open

Auditing BulkWrite in MogoDB #185

renegadeHomie opened this issue Feb 15, 2017 · 3 comments

Comments

@renegadeHomie
Copy link

Hi,
I successfully implemented this gem for document create, update and destroy.

But I am doing a Bulk Write operation in my program and the history tracker is not able to track those changes.

Does mongoid-history support Bulk Write? If yes, how should it be implemented and if no what can be done to make it track all Bulk write operations.

Thanks

@dblock
Copy link
Collaborator

dblock commented Feb 15, 2017

How do you do a bulk insert? If it's via collection.insert, you're effectively bypassing Mongoid and going to the MongoDB ruby driver, so there're no callbacks as far as I know.

@renegadeHomie
Copy link
Author

bulk = Mongo::BulkWrite.new(ModelName.collection, insertdata, ordered: false) bulk.execute
I am using the above query, where insertdata is an array containing data to be written!
I am using Mongo::BulkWrite as you can see.

@dblock
Copy link
Collaborator

dblock commented Feb 15, 2017

Oh that's new, I've never used it. I think for a bulk write we'd want a bulk history update, so some kind of extension that goes over documents, figures out the tracked data, appends it to insertdata, then bulk inserts it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants