You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to update an item inside a document's array via positional operator $ of Mongoose/MongoDB query, and thus need to not only pass ID of an updated document but also an additional query for array objects. Despite all attempts Mongoose says that "The positional operator did not find the match needed from the query. Unexpanded update: faculcies.$.name".
I call 'PUT' on URL like /univercities/{docID}?faculcies._id={faculcyID} via fetch:
The hook.params.query becomes { 'faculcies._id': '589d3fc48fe3632ed854beee' }, but this additional query seems to be ignored. All IDs are valid and there are no spelling mistakes.
It is also impossible to 'PUT' something on /univercities?_id={univercityID}&faculcies._id={faculcyID}.
Am I missing something? Or is it something just not implemented?
The text was updated successfully, but these errors were encountered:
From what I understand, faculcies is an array but faculcies._id will try to query for { faculcies: { _id } }. You will have to use the $elemMatch selector to find items in an array.
I would like to update an item inside a document's array via positional operator
$
of Mongoose/MongoDB query, and thus need to not only pass ID of an updated document but also an additional query for array objects. Despite all attempts Mongoose says that "The positional operator did not find the match needed from the query. Unexpanded update: faculcies.$.name".I call 'PUT' on URL like /univercities/{docID}?faculcies._id={faculcyID} via fetch:
The
hook.params.query
becomes{ 'faculcies._id': '589d3fc48fe3632ed854beee' }
, but this additional query seems to be ignored. All IDs are valid and there are no spelling mistakes.It is also impossible to 'PUT' something on
/univercities?_id={univercityID}&faculcies._id={faculcyID}
.Am I missing something? Or is it something just not implemented?
The text was updated successfully, but these errors were encountered: