Cursor Methods: Max
Limiting a maximum value for a query in the collection.
🪶 The max method defines a maximum value for the query
, which must not exceed the specific limit.1 import MerlinDB, { Schema} from "@chrisaxxwell/merlin-db";2 //Or if you are using 'merlindb.max.js' just call 'new MerlinDB()'; 3 4 const merlin = new MerlinDB( ) ;5 merlin.connect( "USER-DATABASE") ; 6 var userModel = merlin.model( "User", <userSchema>) ;7 8 //cursor.max(<object>); 9 userModel.find( { age: 23 } ) 10 .max( { age: 40 } ) 11 .then( e => { 12 console.log( e) ; 13 //returns all documents where the age is equal to 23 and less than 40 14 } )