User Tools

Site Tools


mongo_magic

MongoDB - Tips & Tricks

This article is just a reference for useful patterns, queries, tips and tricks regarding MongoDB and its python clients.

Operations

maybe the following can be helpful to check whats running on a db (monitoring?)

db.currentOP(true)

Indexing

get the total index size for a collection:

db.getCollection('meta_db_collection').totalIndexSize()

when creating an index in background, check the progress:

db.currentOp(true).inprog.forEach(function(op){ if(op.msg!==undefined) print(op.msg) })

Tags

mongo, pymongo, motor, index

mongo_magic.txt · Last modified: 2024/04/11 14:23 by 127.0.0.1