26

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.

3 Answers 3

45

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.

9

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.

1

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.