I am currently using mongoose, with this model instructions in model called tickets
Fromticket, Number default 0 Toticket, number, default 0
Let say I have these rows:
{fromticket:1 , toticket:3000},
fromticket:3001 , toticket:29000}
,
how can I find the row that contains for example the ticket is 20000? Or 3001? ( would be row number 2 in the example)
Tickets.find( row where owner is ticket 2000)
Each term in a query is implicitly ANDed, so you can query for the document where fromticket <= 20000
and toticket >= 20000
using:
var ticket = 20000;
Tickets.findOne({
fromticket: {$lte: ticket},
toticket: {$gte: ticket}
}, (err, ticket) => {...});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.