try ..
db.mycollection.update(
{'_id': ObjectId("5150a1199fac0e6910000002")},
{ $pull: { "items" : { id: 23 } } },
false,
true
);
Вы можете проверить, что any
из strings
в each
начинается с того, что в words
, например,
>>> each
'abctotech present'
>>> word
'abc present'
>>> all(any(y.startswith(x) for y in each.split()) for x in word.split())
True
>>> each1
'toabctotech present'
>>> all(any(y.startswith(x) for y in each1.split()) for x in word.split())
False