pofider / node-simple-odata-server

Simple OData server for node.js
MIT License
97 stars 61 forks source link

unexpected result for $filter by _id #51

Open satadhi4alumnux opened 1 year ago

satadhi4alumnux commented 1 year ago

Hello, Can you please explain they need of code line,

 if (Object.prototype.hasOwnProperty.call(queryOptions.$filter, '_id')) {
      sAdditionIntoContext = sAdditionIntoContext.length > 0 ? '(' + sAdditionIntoContext + ')/$entity' : '/$entity'
      out['@odata.context'] = cfg.serviceUrl + '/$metadata#' + req.params.collection + sAdditionIntoContext
      if (result.length > 0) {
        for (const key in result[0]) {
          out[key] = result[0][key]
        }

I check in the OData docs, but I don't see the need of this. Can you please explain the reason behind this logic ?