Ratatata
Всем привет. Подскажите пожалуйста. я возвращаю массив документов(которые были отфильтрованы с помощью aggregation). У этих документов есть поле "itemId", которое идентично полю "id" документов из другой коллекции. Как мне вернуть конечный массив документов, но дополненных еще и информацией документов из другой коллекции(т.е что-то вроде $lookup, но лишь нужные документы)
Alexandr
Всем привет. Пытался тестово прогнать upgrade с 4.4 на 5.0.14. Пользовался инструкцией:
https://docs.percona.com/percona-server-for-mongodb/5.0/install/upgrade-from-44.html
После запуска 5й версии получаю ошибку:
trap invalid opcode ip:55ee05a584ea sp:7fffeb859aa0 error:0 in mongod[5lid opcode ip:55ee05a584ea sp:7fffeb859aa0 error:0 in mongod[55ee01865000+550e000]
trap invalid opcode ip:55ee05a584ea sp:7fffeb859aa0 error:0 in mongod[5lid opcode ip:55ee05a584ea sp:7fffeb859aa0 error:0 in mongod[55ee01865000+550e000]
Не нашел каких то объяснений в интернете, кроме как совместимость процессоров. КТо нибудь сталкивался с такой ошибкой?
Роман
Потому что мне интересно, если допустим пользователь ссылается на товар, а если удалить этот ОbjectId, то что произойдёт то
Anonymous
node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. node:internal/modules/cjs/loader:1218:14
(node:7246) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
(node:7246) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:7246) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:7246) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
(node:7246) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:7246) DeprecationWarning: Mongoose: findOneAndUpdate() and findOneAndDelete() without the useFindAndModify option set to false are deprecated. See: https://mongoosejs.com/docs/deprecations.html#-findandmodify-
{
id: 6145344981,
is_bot: true,
first_name: 'TestInvest',
username: 'testinvestsabot',
can_join_groups: true,
can_read_all_group_messages: false,
supports_inline_queries: false
}
/storage/emulated/0/Brawlstars/node_modules/mongodb-core/lib/connection/pool.js:443
return handleOperationCallback(self, workItem.cb, new MongoError(responseDoc));
^
MongoError: (Unauthorized) not authorized on admin to execute command { insert: "users", documents: [[{trees []} {_id ObjectID("5dfaac928d3ea75ef63263ba")} {id 0} {buybalance 0} {outbalance 0} {bhivebalance 0} {wb_profits 0} {name Infix ©} {fc 0} {ref 0} {regDate 18/12/2019} {deposit 0} {payout 1100} {fetuses 0} {menu {"price":20,"status":false,"count":5,"bought":3}} {lastCollect 1.576709266975e+12} {ban false} {refCount 0} {not false} {v 0} {totalEarn 0}] [{trees []} {_id ObjectID("5dfbe31493b06e7818e2c5d7")} {id 1} {menu {"price":20,"status":true,"count":5,"bought":3}} {v 0} {totalEarn 0}]], ordered: true, writeConcern: { w: "majority" }, lsid: { id: {4 [71 86 255 36 185 18 76 71 190 219 77 248 205 28 175 83]} }, txnNumber: 1.000000, $clusterTime: { clusterTime: {1675346250 1}, signature: { hash: {0 [233 233 43 216 117 159 144 102 182 27 218 212 128 69 153 135 55 56 75 203]}, keyId: 7161800894554570752.000000 } }, $db: "admin" }
at Connection.<anonymous> (/storage/emulated/0/Brawlstars/node_modules/mongodb-core/lib/connection/pool.js:443:61)
at Connection.emit (node:events:513:28)
at processMessage (/storage/emulated/0/Brawlstars/node_modules/mongodb-core/lib/connection/connection.js:364:10)
at TLSSocket.<anonymous> (/storage/emulated/0/Brawlstars/node_modules/mongodb-core/lib/connection/connection.js:533:15)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
ok: 0,
errmsg: '(Unauthorized) not authorized on admin to execute command { insert: "users", documents: [[{trees []} {_id ObjectID("5dfaac928d3ea75ef63263ba")} {id 0} {buybalance 0} {outbalance 0} {bhivebalance 0} {wb_profits 0} {name Infix ©} {fc 0} {ref 0} {regDate 18/12/2019} {deposit 0} {payout 1100} {fetuses 0} {menu {"price":20,"status":false,"count":5,"bought":3}} {lastCollect 1.576709266975e+12} {ban false} {refCount 0} {not false} {v 0} {totalEarn 0}] [{trees []} {_id ObjectID("5dfbe31493b06e7818e2c5d7")} {id 1} {menu {"price":20,"status":true,"count":5,"bought":3}} {v 0} {totalEarn 0}]], ordered: true, writeConcern: { w: "majority" }, lsid: { id: {4 [71 86 255 36 185 18 76 71 190 219 77 248 205 28 175 83]} }, txnNumber: 1.000000, $clusterTime: { clusterTime: {1675346250 1}, signature: { hash: {0 [233 233 43 216
Anonymous
117 159 144 102 182 27 218 212 128 69 153 135 55 56 75 203]}, keyId: 7161800894554570752.000000 } }, $db: "admin" }',
code: 8000,
codeName: 'AtlasError',
[Symbol(mongoErrorContextSymbol)]: {}
}
Gleb
Приветствую вас, коллеги!
Подскажите пожалуйста: у меня есть список категорий, просто список со строками по сути. Как мне его лучше хранить в базе данных?
Потому что мне каждый раз нужно из бд подтягивать весь список, чтобы он отображался в приложении. Потом есть функция добавления категорий, и мне надо будет обновлять уже существующий документ, или хранить кучу доков с каждой категорией?
bravo
Как сделать запрос в базу при этом сразу отсортировать по дате и забрать нужные параметры ?
gen_time = datetime(2022, 8, 6)
dummy_id = ObjectId.from_datetime(gen_time)
result = db.1.2.find({},{"_id": {"$lt": dummy_id}, "document.id": 1, "document.ud": 1, "document.uy": 1, "stat": 1})
по