Mongoose delete nested object at unknown position by property - database

I know there are several question similar to this one, but none of the ones Ive seen worked for me.
Im trying to delete an object from my collection, which look something like this (but changes often, there may be more nested objects etc.):
storage:Array
0:Object
folders:Array
0:Object
stored:Array
0:Object
files:Object
name:"1"
snippet:"snippet 1"
_id:60bcafda1e2b8b4a288cd822
1:Object
files:Object
name:"2"
snippet:"snippet 2"
_id:60bcafda1e2b8b4a288cd823
2:Object
files:Object
name:"3"
snippet:"snippet 3"
_id:60bcafda1e2b8b4a288cd824
3:Object
files:Object
name:"4"
snippet:"snippet 4"
_id:60bcafda1e2b8b4a288cd825
4:Object
files:Object
name:"5"
snippet:"snippet 5"
_id:60bcafda1e2b8b4a288cd826
5:Object
files:Object
name:"6"
snippet:"snippet 6"
_id:60bcafda1e2b8b4a288cd827
6:Object
folders:Object
name:"indented folder"
_id:60bcafda1e2b8b4a288cd828
stored:Array
0:Object
files:Object
name:"indented file 1"
snippet:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blandit..."
_id:60bcafda1e2b8b4a288cd829
_id:60bcafda1e2b8b4a288cd82a
name:"test"
_id:60bcafda1e2b8b4a288cd821
files:Array
0:Object
name:"message"
snippet:"Hello World!"
_id:60bcafda1e2b8b4a288cd82b
I only know the _id property of the object I want to delete (not the position/index), any help/advice would be greatly appreciated!

Related

string of /static/media/~ was displayed instead of its markdown content in react js

while I referred to material ui blog template,I develop my blog app,I import markdown file as import post1 from './blog-posts/blog-post.1.md';
after that,these properties are passed to this component,as <Markdown className="markdown" key={post.substring(0, 40)}> I intended to show its content in 40 letters.
But it returned following path. it seems that build path of this content
0: "/static/media/blog-post.1.50d9283f83f7cfcc4000.md"
1: "/static/media/blog-post.2.8e855c6626746019d87c.md"
2: "/static/media/blog-post.3.f65a9b04dd86fcb4de03.md"
My desired result is like following,content shold be displayed.
April 1, 2020 by Olivier
This blog post shows a few different types of content that are supported and styled with Material styles. Basic typography, images, and code are all supported. You can extend these by modifying Markdown.js.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean eu leo quam.
Why its contents didnt displayed in my method.
Are there any wrong point of that ?
Thanks

Solr returns different result for each letter change

When I try searching for products that are having "camel" in their display names. All the indexing procedure have been done. The problem here is:
When I search "camel" I get: 1 product
"name": "CHANEL HYDRA BEAUTY CAMELLIA WATER CREAM ILLUMINATING HYDRATING FLUID 30ML"
But When I search "CAMELL": I get 3 products from solr:
{
"name": "CLE DE PEAU Lipstick #5 Camellia"
},
{
"name": "CHANEL HYDRA BEAUTY CAMELLIA WATER CREAM ILLUMINATING HYDRATING FLUID 30ML"
},
{
"name": "HERA Rouge Holic Shine No.315 Camellia Orange"
}
When I search CAMEL. I must have got these 3 as well. Why isn't it working?
The issue was fixed after setting the wildcard flag as true to the indexed properties, in Hybris. Thanks to everyone for your help and ideas.

Creating schema not successful in Solr

I have the data ready for index now, it is a json file:
{"122": "20180320-08:08:35.038", "49": "VIPER", "382": "0", "151": "1.0", "9": "653", "10071": "20180320-08:08:35.088", "15": "JPY", "56": "XSVC", "54": "1", "10202": "APMKTMAKING", "10537": "XOSE", "10217": "Y", "48": "179492540", "201": "1", "40": "2", "8": "FIX.4.4", "167": "OPT", "421": "JPN", "10292": "115", "10184": "337912000000002", "456": "101", "11210": "337912000000002", "1133": "G", "10515": "178", "10": "200", "11032": "-1", "10436": "20180320-08:08:35.038", "10518": "178", "11": "337912000000002", "75": "20180320", "10005": "178", "10104": "Y", "35": "RIO", "10208": "APAC.VIPER.OOE", "59": "0", "60": "20180320-08:08:35.088", "528": "P", "581": "13", "1": "TEST", "202": "25375.0", "455": "179492540", "55": "JNI253D8.OS", "100": "XOSE", "52": "20180320-08:08:35.088", "10241": "viperooe", "150": "A", "10039": "viperooe", "39": "A", "10438": "RIO.4.5", "38": "1", "37": "337912000000002", "372": "D", "660": "102", "44": "2.0", "10066": "20180320-08:08:35.038", "29": "4", "50": "JPNIK01", "22": "101"}
You can inspect the json here: https://jsonformatter.org/
I need to create index and enable searching on tags: 37(order_id), 75(trade_date) and 10242 (where available, this sample message doesn't have it)
My understanding is I need to create the file managed-schema, I added two fields as below:
<field name="order_id" type="text_general" indexed="true" stored="false" multiValued="true"/>
<field name="trd_date" type="text_general" indexed="true" stored="false" multiValued="true"/>
Then I go back to Solr Admin, I don't see the two new fields in Schema section
Anything I am missing here? and once the two fields are put in the managed-schema, can I add the json file through upload in Solr Admin?
Thank you very much.
Update: I have 100+ fields in the data to be index'ed, the data is a json file format. I wonder what is the best practice to create the schema file, thanks.
You shouldn't have to create the file yourself, that should be created by Solr (since it's a managed schema). If you're manually editing the file, you have to reload the collection/core or restart Solr afterwards.
Otherwise you can use the Schema API to add or change fields. If you're running in a cloud context / cluster, you'll want to use the Schema API so that your changes can be spread across all nodes (and your schema would live in Zookeeper in that case anyway).

ng-filter with filter is not filtering

hi I'm trying to filter a list of objects in an array and displaying it. The filtering is based on the users input from an input field.
I've had a look at number of questions on Stackoverflow, but I feel this is different- since my data is already in an array.
Html:
<body ng-app="MyApp">
<div ng-controller="MyCtrl">
<form class="form-inline">
<input ng-model="search" type="text"
placeholder="Filter by" autofocus>
</form>
<div ng-repeat="f in feedbacklist | filter:search ">
<div>{{f.jobId}}</div>
</div>
</div>
</body>
JS:
var app = angular.module("MyApp", []);
app.controller("MyCtrl", function($scope) {
$scope.search = "";
$scope.feedbacklist = [
{
jobId: "1432",
feedbackId: "342342",
profileUrl: "assets/img/profiles/avatar_small2x.jpg",
address: "24 Mathers St, Smithswood",
name: "Jorem Ipsum",
initials: "JP",
content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
date: "23/05/2016",
message: "",
replies: [
{
jobId: "1232",
feedbackId: "342342",
profileUrl: "assets/img/profiles/avatar_small2x.jpg",
address: "24 Mathers St, Smithswood",
name: "Jorem Ipsum",
initials: "JP",
content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
date: "23/05/2016",
},
{
jobId: "1232",
feedbackId: "342342",
profileUrl: "assets/img/profiles/avatar_small2x.jpg",
address: "24 Mathers St, Smithswood",
name: "Jorem Ipsum",
initials: "JP",
content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
date: "23/05/2016",
}
],
},
{
jobId: "1232",
feedbackId: "342342",
profileUrl: "",
address: "24 Mathers St, Smithswood",
name: "Jorem Ipsum",
initials: "JP",
content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
date: "23/05/2016",
message: "",
replies: [
],
},
];
});
I've created a fiddle here
This code don't find any issue with your code. The only thing I want to know is on which property in the object you want to filter?
If you want to filter it by 'JobId' then use this code
filter:{jobId:search}
Fiddle Link

What is the correct syntax for api_version in app.yaml?

I was previously using "api_version: 1" but when I update to "api_version: 2" I get the error "api_version '2' is not supported by the 'python27' runtime." I also tried 1.1 with the same error message. I'm sure it is something simple, but haven't found it yet.
I needed to update "version: 1" to "version: 2", not "api_version: 1" to "api_version: 2". And, just for the record, "version: 1.1" did not work.

Resources