small fixes
This commit is contained in:
		@@ -4,7 +4,7 @@ import db from '../db';
 | 
			
		||||
const ModelSchema = new mongoose.Schema({
 | 
			
		||||
  group: {type: String, index: {unique: true}},
 | 
			
		||||
  models: [new mongoose.Schema({
 | 
			
		||||
    name: {type: String, index: {unique: true}},
 | 
			
		||||
    name: String,
 | 
			
		||||
    url: String,
 | 
			
		||||
    label: String
 | 
			
		||||
  } ,{ _id : false })]
 | 
			
		||||
 
 | 
			
		||||
@@ -262,7 +262,9 @@ router.get('/samples', async (req, res, next) => {
 | 
			
		||||
 | 
			
		||||
  // count total number of items before $skip and $limit, only works when from-id is not specified and spectra are not
 | 
			
		||||
  // included
 | 
			
		||||
  if (!filters.fields.find(e => e.indexOf(globals.spectrum.spectrum + '.') >= 0) && !filters['from-id']) {
 | 
			
		||||
  if (!filters.fields.find(e =>
 | 
			
		||||
    e.indexOf(globals.spectrum.spectrum + '.' + globals.spectrum.dpt) >= 0) && !filters['from-id']
 | 
			
		||||
  ) {
 | 
			
		||||
    queryPtr.push({$facet: {count: [{$count: 'count'}], samples: []}});
 | 
			
		||||
    queryPtr = queryPtr[queryPtr.length - 1].$facet.samples;  // add rest of aggregation pipeline into $facet
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user