public void Upsert(ObjectId categoryId, ObjectId[] productIds) { var ranking = GetByCategoryId(categoryId); if (ranking == null) { ranking = new RatioRanking(); ranking.CategoryId = categoryId; } ranking.ProductIds = productIds; ranking.UpdateTime = DateTime.Now; Collection.Save(ranking); }