Hi,
I try to "upsert" document in a mongodb collection.
When the document exists, PutMongo processor update the document but when
the document doesn't exist the processor do not create it.
Here is the setting of my PutMongo processor :
        Mode : updateg
        Upsert : true
        Update Query Key : identifiant
        Update Query : null
        Update Mode : With Operator Enabled

I have read the PutMongodb.java and notice a strange thing when preparing
mongodb update request :
                if (!StringUtils.isBlank(updateKey)) {
                    query = parseUpdateKey(updateKey, (Map)doc);
                    removeUpdateKeys(updateKey, (Map)doc);
                } else {
                    query = Document.parse(filterQuery);
                }
When using updateKey, it builds the query with the updateKey and removes
this key from the document so it creates the document without the key.
The document is created but there is missing part of the document.
When using update_query mode, it does remove anything form the document.

I simply remove the removeUpdateKeys() method call in a test custum
processor. And it works fine.

Is that path correct ?

Thank

Yves HAMEL
(Embedded image moved to file: pic07711.jpg)

Yves HAMEL
Direction Digital & Systèmes d’Information Groupe
LM_DATA

MACIF - 2 et 4, rue Pied de Fond - 79037 Niort cedex 9
Tél. : +33 (0)5 49 09 36 06
Email : [email protected] / Pré Doyen 2 – bureau 999

www.macif.fr - Appli présente sur Google Play Store & Apple Store
(Embedded image moved to file: pic28253.jpg)

Reply via email to