A
A
Anton2021-02-01 13:56:38
MongoDB
Anton, 2021-02-01 13:56:38

How to set the default option?

Is it possible for all future documents in the collection to set a default field value?
I want to make the "toDelete" flag: true/false

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2021-02-01
@hunk3r

At the moment there is no such possibility, but there was a small discussion in the MongoDB jet about such a possibility a few years ago.
Until such a possibility appears, the best thing to do is to put the default value in the code that creates / saves a new document in the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question