次のコードを使用して、指定された mongoDB コレクションからすべての要素を削除していますparent_id
。
final String strQuery = "db.Child.remove({'$query':{'PARENT_ID':'" + parentId + "'}})";
final Query query = entityManager.createNativeQuery(strQuery, Child.class);
query.executeUpdate();
ただし、次の例外が発生します。
Unexpected Exception
com.mongodb.util.JSONParseException:
db.Child.remove({'$query':{'CHILD_ID':'7313c076-dbaa-4557-b80f-68d040b65d82'}})
に置き換えるremove
とfind
、結果が返されます。上記のネイティブ クエリで JSON パーサー エラーの原因がわかりません。
mongo-db 3.2 で hibernate-ogm バージョン 4.3 Final を使用しています