Commit 8d6aab9a authored by Ryan Berkheimer's avatar Ryan Berkheimer
Browse files

updated comments to be more instructive (mongo_remove_one, mongo_remove_many)

parent 5eaf993e
......@@ -136,23 +136,29 @@ def mongo_replace_one(collection, record, argument):
def mongo_remove_one(collection, record):
""" Removes a single specified record from the specified collection.
""" Removes a single specified record from the specified collection, using
the given record (Argument). For example, the record could be an entire record,
just an id, or another key value argument. This will remove the first matching
record with the given argument. Returns the number of records removed.
"""
try:
return collection.delete_one(record)
deletion = collection.delete_one(record)
return deletion.deleted_count
except:
print 'Could not remove record'
return False
return 0
def mongo_remove_many(collection, record):
""" Removes a single specified record from the specified collection.
""" Removes all documents in the given collection with the given record (argument).
For example, the record could be an entire record,
just an id, or another key value argument. This will remove all matching
records with the given argument.
"""
try:
return collection.delete_many(record)
deletion = collection.delete_many(record)
return deletion.deleted_count
except:
print 'Could not remove records'
return False
return 0
def mongo_update_one(collection, argument, update):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment