Whats the best option to use for MongoID data type for the regular MongoDB TEXT data type.
Wondering why MongoID doesnt have a data type TEXT.
is it okay to use STRING type and store large amounts of data.
P.S coming from SQL background.
According to the mongoid documentation all fields are strings, unless we explicitly specify an other data types. Unlike SQL's
varchar
and text
differences, strings in mongo
have no limitation (the only limitation is that of the 16MB maximum document size) so there is no need to worry about size.
Yes, strings in MongoDB have unlimited length (up to document max size, of course (16MB)). So there was no reason to introduce separate TEXT column type, as do relational DBs.
Just use string type.
You can use String datatype only. There is no reason to use any other datatype as string provides you unlimited length. You can directly use String type for MongoDB text fields.