Question about data modeling

In order to stablish a model, is necessary to use Mongoose? .

No it is not. And I do not recall it mentioned in M320.

1 Like

Hi Steevej-1495
My question is about how to make a schema without pattern. For example a questionary with options (yes/no) would be a boolean (true/false); a nickname would be a string. In this example I would need to create a schema to store data (boolean and string). It can be done with Mongoose (No its not mentioned at all in M320), but it helps, theres another tool like (‘mongodb’).ObjectID but it only gives me strings.
Thanks for your time

Hi @damon634,

That is a very interesting question. I believe you can do that by specifying an array of data types as value to bsonType like this:

  "title": "inquiry",
  "properties": {
    "_id": {
      "bsonType": "objectId"
    "questionary": {
      "bsonType": ["bool", "string"]

Documentation link:


1 Like