isage / lua-resty-moongoo

MongoDB library for OpenResty
Do What The F*ck You Want To Public License
118 stars 33 forks source link

col:del("test-a1",{"$and" = [{"version" = {"$gt" = old_time}},{"version" = {"$lt" = new_time}}]}) #40

Open jicvi opened 4 years ago

jicvi commented 4 years ago

Excuse me! How to achieve

local query = {"$and" = [{"version" = {"$gt" = old_time}},{"version" = {"$lt" = new_time}}]} col:del(query) or col:find(query)

isage commented 4 years ago

Something like this should work

local query = {
  ["$and"] = {
    { version = { ["$gt"] = old_time } },
    { version = { ["$lt"] = new_time } }
  }
}
col:del("test-a1", query)
jicvi commented 4 years ago

Thank you!