1

Here Is my try to remove document with article_link:x

>>> db = client.article_db
>>> collection1 = db.article0510
>>> collection1.remove('article_link': 'http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html')
  File "<stdin>", line 1
    collection1.remove('article_link': 'http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html')
                                     ^
SyntaxError: invalid syntax

Here is my python script:

bse_tagged_link = ['http://www.business-standard.com/article/finance/sfio-probes-10-firms-in-bob-case-115102900994_1.html']
for link in bse_tagged_link:
    lookup_result = self.collection1.find({'article_link': link})
    print lookup_result
    for val in lookup_result:
        if val and val != 'None':
            print val
            self.collection1.remove({'article_link': var['article_link']})

What I want to do is:

  1. Get set of links from table1
  2. lookup links from point 1 into table 2
  3. If link present in table2, remove those record

1 Answer 1

2

Your syntax to remove is incorrect, as evident by the error you got. You should use this syntax:

collection1.remove({"article_link" : "http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html"})
Sign up to request clarification or add additional context in comments.

1 Comment

@user3449212 no worries, keep asking good questions. I upvoted them :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.