feathersjs-ecosystem / feathers-mongoose

Easily create a Mongoose Service for Feathersjs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how release some function look intro

anyban opened this issue · comments

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!

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,
    },
  }
)

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,
    },
  }
)

result empty []..
will be correct


            .patch(null, {
              $set: { status: 1 },
              query: {
                requester: userId,
                recipient: user._id,
              },
              mongoose: {
                upsert: true,
                new: true,
              },

thanks!

@anyban you managed to make it work ?