[SERVER-20424] Creating Index with invalid properties Created: 15/Sep/15  Updated: 15/Sep/15  Resolved: 15/Sep/15

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.6.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Adamo Tonete Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-769 Validate top-level & index spec field... Closed
Operating System: ALL
Steps To Reproduce:

db.test.save({name : 'mongodb', date: new Date()})
WriteResult({ "nInserted" : 1 })
> db.test.save({name : 'mongodb2'})
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("55f8762792a0ee661e65b90b"), "name" : "mongodb", "date" : ISODate("2015-09-15T19:48:55.803Z") }
{ "_id" : ObjectId("55f8763192a0ee661e65b90c"), "name" : "mongodb2" }
> db.test.ensureIndex({date :1}, {sparsse : true})
{
	"createdCollectionAutomatically" : false,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> db.test.getIndexes()
[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "easytaxi_driver_restore.test"
	},
	{
		"v" : 1,
		"key" : {
			"date" : 1
		},
		"name" : "date_1",
		"ns" : "easytaxi_driver_restore.test",
		"sparsse" : true
	}
]

Participants:

 Description   

When I created a index with a non existing property name by mistake I saw the "inexistent" property at getIndexes() property of my collection.

Is this behaviour expected?



 Comments   
Comment by Stennie Steneker (Inactive) [ 15/Sep/15 ]

Hi Adam,

Thanks for your report. Index options are currently not validated so this is expected behaviour as per SERVER-769.

Please upvote & watch SERVER-769 for updates.

Regards,
Stephen

Generated at Thu Feb 08 03:54:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.