Edward83
Edward83

Reputation: 6686

MongoDB special symbols in fields?

I am interesting, why my documents with fields of type BsonArray not saved into database?

Field names:

If I remove symbol _ from field names my documents are stored in database and all ok. These fields are indexable. What wrong with these field names?

Upvotes: 0

Views: 532

Answers (1)

Remon van Vliet
Remon van Vliet

Reputation: 18595

Nothing, that's perfectly allowed :

> db.test.save({a_a:1})
> db.test.find()
{ "_id" : ObjectId("4eef2d73f6c42df1ecd67a71"), "a_a" : 1 }

Your issue is likely to be somewhere else. Note that you should use the latest stable version to verify this as there were some issues with special symbols in field names in earlier versions (although I do not recall this one specifically being one of those fixed issues).

Upvotes: 2

Related Questions