message: many to one case fixed
diff: @@ -852,6 +852,7 @@ function embedChild(objects: Array<any>, prop, relMetadata: MetaData, parentMode
  var searchObj = [];
  let params: IAssociationParams = <any>relMetadata.params;
  let isJsonMap = isJsonMapEnabled(params);
  + let manyToone = {};
  objects.forEach((obj, index) => {
  if (!obj[prop])
  return;
  @@ -918,6 +919,16 @@ function embedChild(objects: Array<any>, prop, relMetadata: MetaData, parentMode
  else {
  val['_id'] = Utils.castToMongooseType(val['_id'].toString(), Mongoose.Types.ObjectId);
  if (params.embedded) {
  + if (relMetadata.decorator == Decorators.MANYTOONE) {
  + if (val && val._id) {
  + let tempVal = val._id.toString();
  + manyToone[tempVal] = manyToone[tempVal] ? manyToone[tempVal] : [];
  + if (manyToone[tempVal].length == 0)
  + searchObj.push(val['_id']);
  + manyToone[tempVal].push(obj);
  + }
  + }
  + else
  // for partial embedding, fetch the object from db and set that object
  if (params.properties && params.properties.length > 0) {
  searchResult[val['_id']] = obj;
  @@ -936,11 +947,18 @@ function embedChild(objects: Array<any>, prop, relMetadata: MetaData, parentMode
  if (!params.embedded) {
  newVal = Utils.castToMongooseType(val.toString(), Mongoose.Types.ObjectId);
  }
  + else {
  + if (relMetadata.decorator == Decorators.MANYTOONE) {
  + manyToone[val] = manyToone[val] ? manyToone[val] : [];
  + if (manyToone[val].length == 0)
  + searchObj.push(val);
  + manyToone[val].push(obj);
  + }
  else {
  // find object
  searchResult[val] = obj;
  searchObj.push(val);
  - //newVal = searchResult[val];
  + }
  }
  }
  }
  @@ -972,9 +990,16 @@ function embedChild(objects: Array<any>, prop, relMetadata: MetaData, parentMode
  if (relMetadata.propertyType.isArray) {
  Utils.pushPropToArrayOrObject(val['_id'].toString(), val, searchResult[obj['_id']][prop], isJsonMap);
  }
  + else {
  + if (relMetadata.decorator == Decorators.MANYTOONE) {
  + manyToone[obj['_id']].forEach(x => {
  + x[prop] = val;
  + });
  + }
  else {
  searchResult[obj['_id']][prop] = val;
  }
  + }
  });
  }));
  }
  