how release some function look intro
anyban opened this issue · comments
anyban commented
Hello, i cant undesrstand how make this request
const docA = await Friend.findOneAndUpdate(
{ requester: UserA, recipient: UserB },
{ $set: { status: 1 }},
{ upsert: true, new: true }
)
im try make this
app.service("freinds")
.update(
null,
{
requester: userId,
recipient: user._id,
},
{
{ $set: { status: 1 }},
mongoose: {
upsert: true,
new: true,
},
}
)
thanks for help!
Gautier commented
Hi !
it's the opposite between second and third parameter. https://docs.feathersjs.com/api/services.html#patch-id-data-params
So
this.app.service('friends').patch(
null,
{ $set: { status: 1 } },
{
query: {
requester: userId,
recipient: user._id,
},
mongoose: {
upsert: true,
new: true,
},
}
)
anyban commented
Hi !
it's the opposite between second and third parameter. https://docs.feathersjs.com/api/services.html#patch-id-data-paramsSo
this.app.service('friends').patch( null, { $set: { status: 1 } }, { query: { requester: userId, recipient: user._id, }, mongoose: { upsert: true, new: true, }, } )
result empty []..
will be correct
.patch(null, {
$set: { status: 1 },
query: {
requester: userId,
recipient: user._id,
},
mongoose: {
upsert: true,
new: true,
},
thanks!