0

In python i am using aggregation for a query and i am using db.runCommand for that . problem is i want to insert the variable collection name instead of its actual name . suppose the collection name is xyz .

 collec = 'xyz'
 func_(collec)

now in another file i am using

 def func_(collection1):
     data = db.runCommand('aggregate', 'collection1', pipeline=pipe)

so how to use this collection1 instead of xyz in this db.runCommand

1 Answer 1

2

do you mean this?

def func_(collection1):
    data = db.runCommand('aggregate', collection1, pipeline=pipe)
Sign up to request clarification or add additional context in comments.

2 Comments

yes i want it to be like this but the actual name of collection is xyz
so just call your function like func_("xyz")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.