node.js - Mongoose - flexible field -
i new nosql , mongodb, building app nodejs , mongoose, , building mongoose schema new collection.
the documents of collection have standard fields (id, creation date, user etc...) need store other stuff, "data" field have contain different data depending on document. value simple text , other times have lots of key/values pairs.
i wondering best solution kind of storing needs :
-create 1 "data" field string type , put different types of data (text simple values, stringified objects more complex data)
-create in model possible fields "more complex data" have , use ones need in each document
-something else
what best practice kind of thing ?
try use mixed schematype, think that's looking for: http://mongoosejs.com/docs/schematypes.html
Comments
Post a Comment