Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

mongoose select

// include a and b, exclude other fields
query.select('a b');
// Equivalent syntaxes:
query.select(['a', 'b']);
query.select({ a: 1, b: 1 });

// exclude c and d, include other fields
query.select('-c -d');

// Use `+` to override schema-level `select: false` without making the
// projection inclusive.
const schema = new Schema({
  foo: { type: String, select: false },
  bar: String
});
// ...
query.select('+foo'); // Override foo's `select: false` without excluding `bar`

// or you may use object notation, useful when
// you have keys already prefixed with a "-"
query.select({ a: 1, b: 1 });
query.select({ c: 0, d: 0 });
Comment

PREVIOUS NEXT
Code Example
Javascript :: js do while 
Javascript :: how to redirect to another page in react js on button click 
Javascript :: mouse position 
Javascript :: stdout javascript 
Javascript :: jquery slider move event 
Javascript :: generator function javascript 
Javascript :: call a self executing function javascript 
Javascript :: javascript update multiple values of an object 
Javascript :: monaco editor events 
Javascript :: remove an last item of array in javascript 
Javascript :: date to string format javascript 
Javascript :: prepen an element js 
Javascript :: split in javascript 
Javascript :: How to pass data in Link of react-router-dom 
Javascript :: how to add footer in every page jspdf 
Javascript :: javascript get last word in string 
Javascript :: create new component in angular 
Javascript :: react click outside class implementation 
Javascript :: document.queryselector 
Javascript :: save file javascript 
Javascript :: find method javascript 
Javascript :: javascript refresh element 
Javascript :: clearinterval in javascript 
Javascript :: replace char at index of string 
Javascript :: how to convert string to number in javascript 
Javascript :: async and await 
Javascript :: object promise javascript 
Javascript :: form an array from i to j javascript 
Javascript :: js number padding to number of characters 
Javascript :: from array create two arrayjavascript 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =