W
W
Wynell_ru2020-02-16 14:09:59
Python
Wynell_ru, 2020-02-16 14:09:59

MongoEngine - How to implement SetOnInsert?

You need to do the same as done with $setOnInsert in pymongo

class User(Document):
  test = IntField()

User(test=5).update(test=6,tost=7,upsert=True) # Необходимо сделать еще одно поле tust=8, если выполняется upsert (в самой монго для этого есть $setOnInsert)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alternativshik, 2020-02-16
@alternativshik

https://github.com/MongoEngine/mongoengine/issues/308

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question