Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SERVER-26462 Check if _buffer is allocated in DocumentStorage::clone()
- Loading branch information
1 parent
a7f147a
commit c1567ab
Showing
3 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Tests that adding a field that only contains metadata does not cause a segmentation fault when | ||
// grouping on the added field. | ||
(function() { | ||
"use strict"; | ||
|
||
// Drop the old test collection, if any. | ||
db.server26462.drop(); | ||
|
||
// Insert some test documents into the collection. | ||
assert.writeOK(db.server26462.insert({"_id": 1, "title": "cakes and ale"})); | ||
assert.writeOK(db.server26462.insert({"_id": 2, "title": "more cakes"})); | ||
assert.writeOK(db.server26462.insert({"_id": 3, "title": "bread"})); | ||
assert.writeOK(db.server26462.insert({"_id": 4, "title": "some cakes"})); | ||
|
||
// Create a text index on the documents. | ||
assert.commandWorked(db.server26462.createIndex({title: "text"})); | ||
|
||
// Add a metadata only field in the aggregation pipeline and use that field in the $group _id. | ||
let res = db.server26462 | ||
.aggregate([ | ||
{$match: {$text: {$search: "cake"}}}, | ||
{$addFields: {fooScore: {$meta: "textScore"}}}, | ||
{$group: {_id: "$fooScore", count: {$sum: 1}}} | ||
]) | ||
.itcount(); | ||
|
||
// Assert that the command worked. | ||
assert.eq(2, res); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters