Skip to content

Commit c6bbc48

Browse files
committed
Reverting the collection name check on insert.
[ RUBY-492 ]
1 parent e7b70cd commit c6bbc48

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

lib/mongo/collection.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,6 @@ def save(doc, opts={})
369369
#
370370
# @core insert insert-instance_method
371371
def insert(doc_or_docs, opts={})
372-
if name.start_with?("system.") && name !~ /(\Asystem\.users)|(\Asystem\.indexes)/
373-
raise Mongo::InvalidNSName, "cannot insert into system collections."
374-
end
375372
doc_or_docs = [doc_or_docs] unless doc_or_docs.is_a?(Array)
376373
doc_or_docs.collect! { |doc| @pk_factory.create_pk(doc) }
377374
write_concern = get_write_concern(opts, self)

test/functional/collection_test.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,6 @@ def test_ensure_index_timeout
10751075
coll.ensure_index([['a', 1]])
10761076
end
10771077

1078-
def test_insert_raises_exception_on_system_collection
1079-
collection = @@db["system.foo"]
1080-
assert_raise Mongo::InvalidNSName do
1081-
collection.insert({ :a => 1 })
1082-
end
1083-
end
1084-
1085-
def test_save_raises_exception_on_system_collection
1086-
collection = @@db["system.foo"]
1087-
assert_raise Mongo::InvalidNSName do
1088-
collection.save({ :a => 1 })
1089-
end
1090-
end
1091-
10921078
if @@version > '2.0.0'
10931079
def test_show_disk_loc
10941080
@@test.save({:a => 1})

0 commit comments

Comments
 (0)