“Wie in MongoDb” Code-Antworten

MongoDB Fund wie

db.users.find({"name": /.*m.*/});

db.users.find({"name": /m/});

Items.find({"description": {$regex: ".*" + variable + ".*"}}).fetch();
Concerned Chipmunk

wie MongoDB

db.collection.find( { "url": { "$regex": ".*a.*"} } );
BlueMoon

wie man MongoDB mit ähnlichem abfragt

db.users.find({"name": /m/})
or
db.users.find({"name": /.*m.*/})

You're looking for something that contains "m" somewhere
(SQL's '%' operator is equivalent to Regexp's '.*'), 
not something that has "m" anchored to the beginning of the string.
BlueMoon

Wie in MongoDb

db.users.find({"name": /m/})
Babak

Wie in MongoDb

db.users.find({"name": /.*m.*/})
Babak

Wie in MongoDb

-- mongodb
db.people.find( { user_id: /bc/ } )
-- or 
db.people.find( { user_id: { $regex: /bc/ } } )
-- sql 
SELECT *
FROM people
WHERE user_id like "%bc%"
-- mongodb
db.people.find( { user_id: /^bc/ } )
-- or 
db.people.find( { user_id: { $regex: /^bc/ } } )
--sql 
SELECT *
FROM people
WHERE user_id like "bc%"
Tiny Coders

Ähnliche Antworten wie “Wie in MongoDb”

Fragen ähnlich wie “Wie in MongoDb”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen