|
62 | 62 | authorized_collection.insert_one(document) |
63 | 63 | end |
64 | 64 |
|
65 | | - context 'on server versions >= 3.6' do |
66 | | - min_server_fcv '3.6' |
| 65 | + it 'fails on the driver when a document larger than 16MiB is inserted' do |
| 66 | + document = { key: 'a' * (max_document_size - 27), _id: 'foo' } |
| 67 | + expect(document.to_bson.length).to eq(max_document_size+1) |
67 | 68 |
|
68 | | - it 'fails on the driver when a document larger than 16MiB is inserted' do |
69 | | - document = { key: 'a' * (max_document_size - 27), _id: 'foo' } |
70 | | - expect(document.to_bson.length).to eq(max_document_size+1) |
71 | | - |
72 | | - lambda do |
73 | | - authorized_collection.insert_one(document) |
74 | | - end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/) |
75 | | - end |
| 69 | + lambda do |
| 70 | + authorized_collection.insert_one(document) |
| 71 | + end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/) |
76 | 72 | end |
77 | 73 |
|
78 | | - context 'on server versions <= 3.4' do |
79 | | - max_server_fcv '3.4' |
| 74 | + it 'fails on the driver when an update larger than 16MiB is performed' do |
| 75 | + document = { key: 'a' * (max_document_size - 14) } |
| 76 | + expect(document.to_bson.length).to eq(max_document_size+1) |
| 77 | + |
| 78 | + lambda do |
| 79 | + authorized_collection.update_one({ _id: 'foo' }, document) |
| 80 | + end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/) |
| 81 | + end |
80 | 82 |
|
81 | | - it 'fails on the server when a document larger than 16MiB is inserted' do |
82 | | - document = { key: 'a' * (max_document_size - 27), _id: 'foo' } |
83 | | - expect(document.to_bson.length).to eq(max_document_size+1) |
| 83 | + it 'fails on the driver when an delete larger than 16MiB is performed' do |
| 84 | + document = { key: 'a' * (max_document_size - 14) } |
| 85 | + expect(document.to_bson.length).to eq(max_document_size+1) |
84 | 86 |
|
85 | | - lambda do |
86 | | - authorized_collection.insert_one(document) |
87 | | - end.should raise_error(Mongo::Error::OperationFailure, /object to insert too large/) |
88 | | - end |
| 87 | + lambda do |
| 88 | + authorized_collection.delete_one(document) |
| 89 | + end.should raise_error(Mongo::Error::MaxBSONSize, /The document exceeds maximum allowed BSON object size after serialization/) |
89 | 90 | end |
90 | 91 |
|
91 | 92 | it 'fails in the driver when a document larger than 16MiB+16KiB is inserted' do |
|
0 commit comments