node.js - Can I use bitwise operators to request a Loopback model? -


the strongloop loopback documentation not object retrieval using bitwise filters.

example in loopback api documentation :

// example of syntax, not bitwise filter inventory.find({where: {status: {gt: 4}}); 

with direct connection mongodb, can :

// select items 3rd bit on in `status` field db.inventory.find({status: {$mod: [4, 0]}}); 

can same behind loopback model interface ?

in mongodb docs $were condition can same, while more expensive :

db.inventory.find( { $where: "this.qty % 4 == 0" } ) 

could doing following in loopback :

inventory.find({where: "this.qty % 4 == 0"}); 

or fail ?

is whole idea of using bitwise-oriented status field in model overkill ? should use kind of array field containing list of string status ? isn't expensive in terms of db storage ?

thanks

loopback uses similar json object mongodb describe query. please keep in mind loopback supports multiple databases such mongodb, mysql, , oracle. ideally, operator should supported of them. loopback connectors map native queries.

we don't support bitwise operators connectors yet. mongodb, pass through operators adding $. example, {mod: [ 4, 0 ]) becomes $mod: [ 4, 0 ].

please open issue. we'll follow there.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -