There is a question already in Stackoverflow, very similar with my question. The thing is that the answer for that questions was for a Java Driver, I am trying to do it in the shell.
I am doing this...
db.meta.update({'fields.properties.default': { $type : 1 }}, {'fields.properties.default': { $type : 2 }})
This is not working!
Answers
The only way to change the In this case, it looks like you're trying to change the So simply load the document from the DB, perform the cast ( If you need to do this programmatically and entirely from the shell, you can use the In response to the second comment below. Change the field
| |||
25 | // String to Integer
// Integer to String
| ||||||||
|
8 | This is what I used for string to int conversion.
|
출처 - http://stackoverflow.com/questions/4973095/mongodb-how-to-change-the-type-of-a-field
'DB > MongoDB' 카테고리의 다른 글
mongodb - backup (0) | 2014.02.23 |
---|---|
mongo - TTL (0) | 2014.01.15 |
mongodb - Query, Update and Projection Operators (0) | 2013.07.23 |
mongodb - GridFS (0) | 2013.06.18 |
mongodb - binary data(type) 저장 (0) | 2013.06.18 |
new String(x.bad)
creates collection of Strings with 0-index-itemx.bad
value. Variant""+x.bad
, described by Simone works as desired - creates String value instead of Int32 – Dao Jul 30 '12 at 16:36