MongoDB find and remove - the fastest way

前端 未结 4 899
忘掉有多难
忘掉有多难 2021-02-07 13:56

I have a quick question, what is the fast way to grab and delete an object from a mongo collection. Here is the code, I have currently:

$cursor = $coll->find(         


        
4条回答
  •  感情败类
    2021-02-07 14:28

    I am new to mongodb and not entirely sure what your query is trying to do, but here is how I would do it

    # suppose database is staging
    # suppose collection is data
    use staging
    db.data.remove()
    

    where is a map and can contain any search criteria you want

    Not sure if this would help you.

提交回复
热议问题