Create MongoDB document without values

1.2k Views Asked by At

I have a basic question about creating a physical schema of a collection in MongoDB.

Can I create a MongoDB document without values. At this point I just know the keys and some data types. But I do not have the values. Is it possible to create a schema, where O just have place holders for values?

  • For string, I can put "" or "abc" (dummy value) as place holder for values.
  • For decimal I can do the same. Put 123.1 as dummy value.
  • For Boolean I can put true or false as dummy value
  • For date I can put "01-01-1900" as dummy value

But putting such dummy values becomes complex when I have hundreds of fields, particularly nested ones such as document within a document or arrays.

I am trying to find a SQL world equivalent of "create table" where we can create physical schema, without putting the values

Any advice?

Thanks Aurobindo

1

There are 1 best solutions below

2
On

If you want, you can insert a document with any content (you can insert only part of elements or even empty document). MongoDB is a document-oriented database, where each document can be absolutelly different.

Forget everything what you know about RDBMS, because this knowledge is absolutely useless in MongoDB world.